Solved

pass Object from flex to backend

Posted on 2011-02-10
5
402 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:royjayd
  • 3
  • 2
5 Comments
 
LVL 17

Expert Comment

by:deepanjandas
ID: 34867990
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 34867993
0
 

Author Comment

by:royjayd
ID: 34868074
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
0
 
LVL 17

Accepted Solution

by:
deepanjandas earned 500 total points
ID: 34868125
I have not tried that till now..Need to test with such a scenario.

Warm Regards
Deepanjan Das
0
 

Author Closing Comment

by:royjayd
ID: 35028667
not satisfied with response
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question