[jboss-user] [JBoss Seam] - Seam + Remoting + ajax4jsf question

viniciuscarvalho do-not-reply at jboss.com
Fri Jun 1 15:07:49 EDT 2007


Hello there! I'm trying these combination, and I'm bit confused with the mix, hope someone help me out.

I'm using a Stateful bean that has a property:


  | @Stateful
  | @Name("userService")
  | @Scope(SESSION)
  | public class UserServiceBean implements UserSession{
  | private User user;
  | //this is a webremote method
  | public void setUser(int id){
  | this.user = em.find....
  | }
  | public User getUser()
  | }
  | 

So it's a pretty easy simple bean right :)

The user clicks in a event that triggers the SeamRemoting method:

  | userService = Seam.Component.getInstance("userService");
  | userService.setUser(id);
  | 

So far so good, method is triggered and user is bound to the bean. So The user clicks on another component that uses ajax4jsf to re-render a panel:

  | <img onclick="reDraw()"/>
  | <h:form>
  | <a4j:jsFunction name="redraw" data="#{userService.user}" reRender="userPanel"/>
  | <h:form>
  | <rich:panel id="userPanel">
  | ... contents
  | </rich:panel>
  | 

Now, what happens is that the getUser returns an empty user (as if it is an new invocation) If I call the set user, then reload the page, the user is still null. Seems that the Stateful bean is not being bound to the same client, ajax calls seems to be a different cllient to the container. 
I'm really confused on how to bind the ajax invocations to the stateful bean.

Could someone give me some directions?

Regards

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

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



More information about the jboss-user mailing list