-
1. Re: @Out and default ScopeType
gavin.king Oct 13, 2006 3:27 PM (in response to andrew.rw.robinson)The default behavior has changed in Seam 1.1, so that it would behave the way you describe. And the JavaDoc now specifies the rules clearly.
-
2. Re: @Out and default ScopeType
andrew.rw.robinson Oct 13, 2006 4:22 PM (in response to andrew.rw.robinson)Great news. Thank you. Can't wait for 1.1, looks like it has a lot of nice new functionality
-
3. Re: @Out and default ScopeType
dan.j.allen Nov 25, 2006 2:42 PM (in response to andrew.rw.robinson)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" ) @Scope(CONVERSATION) 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? -
4. Re: @Out and default ScopeType
dan.j.allen Nov 25, 2006 2:44 PM (in response to andrew.rw.robinson)I suppose I should also mention that in this case, the "user" is also annotated with @DataModelSelection.
-
5. Re: @Out and default ScopeType
gavin.king Nov 25, 2006 2:47 PM (in response to andrew.rw.robinson)In Seam 1.1, @Out defaults to the scope of the component with the annotation when the thing being outjected is not a Seam component. So no, you do not need it, at least not in 1.1.
-
6. Re: @Out and default ScopeType
dan.j.allen Nov 30, 2006 10:30 PM (in response to andrew.rw.robinson)I understand my problem. In this particular case, my entity being outjected is a Seam component but not marked with a scope. Therefore, it is taking on the default EVENT scope. If I don't specify the scope on the @Out annotation, my data is placed in the event context, and thus the data does not survive past the redirect. If I add @Scope(CONVERSATION) atop the User class, then it works as expected.
So the point is that it is required to add @Scope(CONVERSATION) either on the entity or on the scope attribute of the @Out annotation for the data to be included in the conversation context if the data IS a seam component. If the User class was not a Seam component, then it would default to the scope of the component outjecting the data. I managed to find myself right between the two scenarios, and hence out of luck. -
7. Re: @Out and default ScopeType
gavin.king Nov 30, 2006 11:44 PM (in response to andrew.rw.robinson)Correct, but the defaulting rules changed in Seam 1.1. You would not need to explicitly specify CONVERSATION in 1.1.