Solved

pass Object from flex to backend

Posted on 2011-02-10
5
411 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
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

Webinar: Security & Encryption in the MySQL world

Join Percona’s Solutions Engineer, Dimitri Vanoverbeke as he presents “Security and Encryption in the MySQL world” on Thursday, July 6, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Question has a verified solution.

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

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…
The conference as a whole was very interesting, although if one has to make a choice between this one and some others, you may want to check out the others.  This conference is aimed mainly at government agencies.  So it addresses the various compli…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

695 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