Solved

pass Object from flex to backend

Posted on 2011-02-10
5
391 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now