[jboss-user] [JBoss Seam] - Weird behaviour with outjection

rlhr do-not-reply at jboss.com
Mon Feb 26 13:23:22 EST 2007


Hello,

I'm using jboss-seam-1.1.7.RC1 with jboss-4.0.5.GA.

I have a SFSB defined as followed:


  | @Stateful
  | @Name("testAction")
  | @Scope(ScopeType.CONVERSATION)
  | public class TestAction implements Test {
  | 
  | 	@In(create=true)
  | 	private EntityManager entityManager;
  | 	
  | 	@RequestParameter
  | 	private Long id;
  | 
  | 
  | 	@Out(required=true)
  | 	private User user = null;
  | 
  | 	public String view() {
  | 
  | 		// Retrieve user
  | 		this.user = entityManager.find(User.class, this.id));
  | 
  | 		return "home";
  | 	}
  | 
  | 	@Destroy
  | 	@Remove
  | 	public void destroy() {
  | 	}
  | 
  | 	/*
  | 	 * Getters and Setters
  | 	 */
  | 
  | 	public User getUser() {
  | 		return user;
  | 	}
  | 
  | 	public void setUser(User user) {
  | 		this.user = user;
  | 	}	
  | }
  | 

In pages.xml, I have:


  | <page view-id="/home.xhtml" action="#{testAction.view}">
  | 	<begin-conversation />
  | </page>
  | 

Here is the strange behaviour:

in /home.xhtml, if I directly use the user object as in #{user.name}, the value returned must be null (nothing shows up in the page).

Now let say that the home page contains #{user.name}, #{user.phone} and #{user.email} in this order. If I change the second entry by #{testAction.user.phone}, I will get a value for the #{testAction.user.phone} but also for #{user.email} (but still not for #{user.name}).

So it looks like the user object is not outjected until the el expression #{testAction.user.phone} is called.

What is even more strange is that it seems to work fine in some other places I use outjection....

Any idea?

Richard

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

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



More information about the jboss-user mailing list