2008年9月18日 星期四

BlazeDS Introduction in remote object of FLEX3 (用英文打了一篇,文法或字有打錯請指教)

For flex,we should retrieve data from the dababase,but in flex framework.It has no function to retrieve directly.We should use some kind of component to achieve that.Because my familiar computer language is java,so I will introduce java data comunication for retrieve data.Here we use BlazeDS.BlazeDS is a j2ee liberary for how to convert the Java data(or said Java Object) to AMF.

And BlazeDS is the only function that I only know how to retrieve the data from java.Next I will introduce how We need to add to the j2ee server to enable the BlazeDS work.First we should download BlazeDS archive,the link is here ,when we have downloaded the file ,please upzip it,we will get two file,one is a .html file,the other is a .war.We all knew that a .war is compression file so we can upzip the war file,then we can see the web application structure.So the need is the three things(1.web.xml2.flex folder 3.lib folder).


We can see a fragement in the web.xml







The BlazeDS must reading the services-config.xml
So we go to the services-config.xml then we can see the below fragement






Because we use RemoteObject component,so we look the remoting-config.xml






Then we should add the tag destination after default-channels

In the destination tag,we must define id ,and name the id attribute,then put the child node properties and its child node source.In the source node,we will put our java class with its package name.














Below is the java method



Below is its method named sendMail,then we can use RemoteObject to call sendMail method of java side.



and use the RemoteObject(flex) instance to call java method(sendMail)



So our RemoteObject(flex) can call the java method successfully.

沒有留言:

張貼留言