[jboss-user] [JBoss Seam] - Difference between @Factory and @Create for outjected compon
shakenbrain
do-not-reply at jboss.com
Mon Oct 8 16:35:34 EDT 2007
I have a page that has the following requirements:
* accessible from a GET request
* begins a conversation
* initializes a component
To do this, I created a method in a SFSB with conversational scope as follows:
@Create
| @Begin(flushMode=FlushModeType.MANUAL)
| public void createTicket() {
| jobTicket = new JobTicket();
| jobTicket.setTitle("Title");
| }
The jobTicket is outjected as follows:
@In(required=false) @Out
| private JobTicket jobTicket;
The XHTML source for the page:
<s:decorate id="titleDecorator" template="/decorateField.xhtml">
| <ui:define name="label">#{messages.Title}</ui:define>
| <h:inputText id="title" value="#{selectedJobTicket.title}" size="80" required="true" autocomplete="off"/>
| </s:decorate>
|
I have nothing in pages.xml that refers to the rendered page. When the page is rendered, the jobTicket appears to be uninitialized- the value for title is not displayed. However, if I look at the conversation in the debug page, the jobTicket object is there, and 'title' is populated with the correct value.
If I change '@Create' to '@Factory("jobTicket")', the page renders as expected- the value for title is displayed. I don't want to use @Factory, because in another bean I want to outject a different jobTicket into a different scope.
Can someone explain to me why there's a difference in behavior? I must be missing something fundamental here...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4092745#4092745
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4092745
More information about the jboss-user
mailing list