[jboss-user] [JBoss Seam] - Remoting problem: object as param not passed

lcoetzee do-not-reply at jboss.com
Thu Jan 25 07:04:30 EST 2007


Hi,

I am playing around with the Seam remoting. I am playing with the helloworld seam application:

I am attempting to pass a seam object (JavaBean) from the browser to the backend. When invoking the method with the parameter, the method is called, but the object is not populated with any values.

In short I have the following:
1. The Javabean:
@Name("person")
  | public class Person  implements Serializable{
  | 
  | 	Integer  id;
  | 	String name;
  | 	String surname;
  | //with getters and setters
  | }

2. The method definition in the interface (HelloLocal):
 
  | @WebRemote 
  |   public void   setPerson(String value, Person person);
  | 

3. The implementation (HelloAction):

  | public void  setPerson(String value, Person person) {
  | 	System.out.println("Received value: " + value);
  | 	
  | 	System.out.println("Received from xhtml page " + person.getName() + " " + person.getSurname());
  | }

4. My Javascript being called in the xhtml:

  |  function sayHello() {
  |       var p = Seam.Component.newInstance("person");
  |       p.setId(15);
  |       p.setName("from");
  |       p.setSurname("sayHello");
  |         Seam.Component.getInstance("helloAction").setPerson("from sayhello", p);
  |     }

When I invoke the sayHello javascript I see the following in the debug window:

  | Thu Jan 25 2007 13:44:32 GMT+0200 (SAST): Request packet:
  | <envelope><header><context></context></header><body><call component="helloAction" method="setPerson" id="1">
  | <params><param><str>dummyvalue</str></param><param><ref id="0"/></param></params><refs><ref id="0"><bean type="person">
  | <member name="id"><number>15</number></member>
  | <member name="name"><str>from</str></member>
  | <member name="surname"><str>sayHello</str></member>
  | </bean></ref></refs></call></body></envelope>

which is the correct values passed to the backend. Unfortunately the person object is not populated, while the string value is sent correctly. The result:

  | 3:57:37,988 INFO  [STDOUT] Received value: from sayhello
  | 13:57:37,990 INFO  [STDOUT] Received from xhtml page null null
  | 

Any suggestions as to why I am not able to send an object as paramter to the server?  Interestingly enough I am able to send a person object (created on the backend and returned with "public Person getPerson()" ) to the javascript.

Thanks

Louis


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4006310#4006310

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4006310



More information about the jboss-user mailing list