[jboss-user] [JBoss Seam] - Re: @Out and default ScopeType

dan.j.allen do-not-reply at jboss.com
Sat Nov 25 14:43:00 EST 2006

Gavin et al,

I am still a bit confused about which scope to use for the @Out annotation.  Let me provide a brief example and hopeful it demonstrates my misunderstanding.

I have the following stub backing bean:

@Name( "userManager" )
  | public class UserManagerBean {
  | 	@In( required = false )
  | 	@Out( required = false, scope = CONVERSATION )
  | 	private User user;
  | 	public String create() {
  | 		return "/user/new.jspx";
  | 	}
  | 	public String view() {
  | 		return "/user/view.jspx";
  | 	}
  | 	public String save() {
  | 		assert user != null;
  | 		// do whatever to save...
  | 		return view();
  | 	}
  | 	// ...other supporting methods, including @Begin and @End methods
  | }

Assume that the flow is: request create -> enter info -> save -> view and that the conversation is being created around this process by some other methods (meaning I know that I have a working conversation).

I am curious to know why I need ScopeType.CONVERSATION on the @Out annotation.  The assertion in the save() method passes, so I know at that point that the property "user" does indeed have a value.  However, if I don't set the scope on the @Out annotation, by the time I get to view.jspx, the EL variables that reference "user" (such as #{user.name}) are all empty.

Is it always necessary to use ScopeType.CONVERSATION for the @Out annotation if the component itself is in conversation scope?

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

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

More information about the jboss-user mailing list