Link to home
Start Free TrialLog in
Avatar of Jay Roy
Jay RoyFlag for United States of America

asked on

pass Object from flex to backend

hi guys

I am using flex in UI with java backend (using spring blazeds integration)


In my java backend i have my

Open in new window

object as

Public class Person extends Base
{
string personrace;
string personage;
String email;
set();
get();
}

Public class Base{
String id;
String name;
set();
get();
}

basically its a person object with person related fields.
Now in my mxml i want to perform a save operation.

how do i go about it ?
this is what i have so far

<fx:Script> 
		<![CDATA[ 
			import mx.rpc.events.ResultEvent; 
			protected function button1_clickHandler():void
			{
	personService.save(PERSON OBJECT); //i want to pass the Person object here
			}
		]]> 
</fx:Script> 
	
	<fx:Declarations>		
		<s:CallResponder id="loadProjectResult"/>
		<services:PersonService id="personService">
			<!-- Place non-visual elements here -->		
			<services:channelSet>
				<!--connect to backend using channel -->
<s:ChannelSet>		 
<s:AMFChannel uri="http://localhost:9080/userweb/messagebroker/amf"/>		
</s:ChannelSet>				
</services:channelSet> 
</services:PersonService>	 
</fx:Declarations>


	<mx:Form x="22" y="10" width="300"> 
		<mx:FormItem> 
			<s:Label text="Person name" />     
			<s:TextInput id="personname"/> 
		</mx:FormItem> 
		<mx:FormItem> 
			<s:Label text="Person id"/>     
			<s:TextInput id="id"/> 
		</mx:FormItem>
		<mx:FormItem> 
			<s:Label text="Email Address" />     
			<s:TextInput id="email"/> 
		</mx:FormItem> 
		<s:Button label="Submit" click="button1_clickHandler()"/> 
	</mx:Form> 
	

Open in new window


PersonService is my service class on the spring side. but how do i pass the person object from the above mxml code to my personService.save  method?
Do i write an equavalant Person.as file with all the fields like Person.java ? , not sure


thanks
Avatar of deepanjandas
deepanjandas
Flag of India image

Avatar of Jay Roy

ASKER

i am using java in my backend.My class structure is like this
Public class Person extends Base
{
string personrace;
string personage;
String email;
}

Public class Base{
String id;
String name;
}

So can i create only a single class called Person.as which contains all the 5 fields like this ?

[RemoteClass(alias="myapp.Person")]           --Person.java class
[Bindable]
public final class Person
{
public var id:String;
public var name:String;
public var personrace:String;
public var personage:String;
public var email:String;
}
 
thanks
ASKER CERTIFIED SOLUTION
Avatar of deepanjandas
deepanjandas
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jay Roy

ASKER

not satisfied with response