Flex can invoke java methods for to make this communication possible we use BlazeDs and remote objects... Study these topics and you will know everthing
1. Remote Objects in Flex 2. BlazeDs in Flex(For communication between java and flex) and try the code then i gave it to you On Sat, Jul 31, 2010 at 11:47 PM, Sidhu Vijay Sidhu <[email protected]>wrote: > Actually this is full code for Client and server Java classes should reside > on middle tier and flex is front end....I wrote already which one flex code > and which one is java and for communication do some configuration in blazeds > in remoting-config file i already sent it to you > > > On Fri, Jul 30, 2010 at 8:25 AM, Gerald Anto Fernando < > [email protected]> wrote: > >> hi sidhu, this is gerald . i saw your code. >> can you please explain me detail. >> *Am new to flex.* >> >> first one is main application class ok >> >> second(TestSession) and third (SessionMgt) are seems like java classes. >> >> if so, shall we call java class directly from flex and where to store it >> and how to compile it(where to store class files) >> or >> flex builder can compile or run the java code. >> >> please make let me clear >> >> >> On Thu, Jul 29, 2010 at 8:01 PM, Sidhu Vijay Sidhu < >> [email protected]> wrote: >> >>> Client side code >>> <?xml version="1.0" encoding="utf-8"?> >>> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >>> layout="horizontal"> >>> >>> <mx:TextInput id="iptUser" /> >>> >>> <mx:RemoteObject id="setService" destination="setsession" >>> result="handleSetResult(event)" fault="handleFault(event)"> >>> </mx:RemoteObject> >>> >>> <mx:RemoteObject id="getService" destination="getsession" >>> result="handleGetResult(event)" fault="handleFault(event)"> >>> </mx:RemoteObject> >>> >>> <mx:Button label="Invoke setSession()"> >>> <mx:click> >>> <![CDATA[ >>> setService.setUser(iptUser.text); >>> ]]> >>> </mx:click> >>> </mx:Button> >>> >>> <mx:Button label="Invoke getSession()" click="getService.getUser()" /> >>> >>> <mx:Script> >>> <![CDATA[ >>> import mx.controls.Alert; >>> import mx.collections.ArrayCollection; >>> import mx.rpc.events.FaultEvent; >>> import mx.rpc.events.ResultEvent; >>> >>> public function handleSetResult(event:ResultEvent):void{ >>> Alert.show(event.result.toString()); >>> } >>> >>> public function handleGetResult(event:ResultEvent):void{ >>> Alert.show(event.result.toString()); >>> } >>> >>> public function handleFault(event:FaultEvent):void{ >>> trace('handleFault()'); >>> trace(event.fault); >>> } >>> ]]> >>> </mx:Script> >>> </mx:Application> >>> ---------------------------------------------- >>> Put this Remoting-config file in blazeds >>> <?xml version="1.0" encoding="UTF-8"?> >>> <service id="remoting-service" >>> class="flex.messaging.services.RemotingService"> >>> <adapters> >>> <adapter-definition id="java-object" >>> class="flex.messaging.services.remoting.adapters.JavaAdapter" >>> default="true"/> >>> </adapters> >>> <default-channels> >>> <channel ref="my-amf"/> >>> </default-channels> >>> >>> >>> <destination id="setsession"> >>> <properties> >>> <source>remoting.SessionMgt</source> >>> </properties> >>> </destination> >>> >>> <destination id="getsession"> >>> <properties> >>> <source>remoting.TestSession</source> >>> </properties> >>> </destination> >>> >>> </service> >>> -------- >>> ServerCode >>> -------------- >>> package remoting; >>> import flex.messaging.FlexContext; >>> import flex.messaging.FlexSession; >>> public class TestSession { >>> FlexSession session; >>> >>> public TestSession(){ >>> session = FlexContext.getFlexSession(); >>> } >>> >>> public String getUser(){ >>> System.out.println(session.getId()); >>> return (String)session.getAttribute("user"); >>> } >>> >>> } >>> second file >>> ------------- >>> package remoting; >>> import flex.messaging.FlexContext; >>> import flex.messaging.FlexSession; >>> public class SessionMgt { >>> FlexSession session; >>> >>> public SessionMgt(){ >>> session = FlexContext.getFlexSession(); >>> } >>> >>> public String setUser(String username){ >>> session.setAttribute("user", username); >>> System.out.println(session.getId()); >>> return "Written to Session"; >>> } >>> } >>> >>> On Thu, Jul 29, 2010 at 6:53 AM, Abdul <[email protected]> wrote: >>> >>>> Hi, >>>> >>>> This may help for you.. >>>> >>>> >>>> http://www.solutionhacker.com/data-intelligence/data-visualization/flex-remoting-and-session-management/ >>>> >>>> >>>> >>>> >>>> On 29 July 2010 13:03, Sarma <[email protected]> wrote: >>>> >>>>> Hi to all, >>>>> >>>>> >>>>> How to maintain the flex session in flex application. If have any >>>>> examples please forward to me. >>>>> >>>>> >>>>> Thanks & Regards, >>>>> M R R Sarma >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Flex India Community" group. >>>>> To post to this group, send email to [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> [email protected]<flex_india%[email protected]> >>>>> . >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/flex_india?hl=en. >>>>> >>>>> >>>> >>>> >>>> -- >>>> *With Regards*, >>>> *Nizar.* >>>> *Disturb @ (+91) 9790503327* >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Flex India Community" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]<flex_india%[email protected]> >>>> . >>>> For more options, visit this group at >>>> http://groups.google.com/group/flex_india?hl=en. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Flex India Community" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<flex_india%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/flex_india?hl=en. >>> >> >> >> >> -- >> Thanks & Regards, >> A Gerald >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Flex India Community" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<flex_india%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/flex_india?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.

