3 Replies Latest reply on Oct 9, 2007 1:07 AM by Matt Drees

    Difference between @Factory and @Create for outjected compon

    Tom Barry Newbie

      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:

      public void createTicket() {
       jobTicket = new JobTicket();

      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"/>

      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...