0 Replies Latest reply on Dec 26, 2007 12:25 PM by asaf sh

    Very strange conversation behavior

    asaf sh Expert

      Hey,
      I'm having a very very strange conversation behavior,

      Following is the scenario:
      I have the following stateful bean:

      @Stateful
      @Name("personActions")
      public class PersonActionsBean implements PersonActions{
      Set<Attr> attrs = new LinkedHashSet<Attr>();
      //getAttrs()
      //setAttrs()
      
      public void prepareCreatePerson() {
      //init the attrs set with some elements
      //init 4 elements!
      }
      
      public void createPreson() {
       //this result 0!
       log.debug("Attrs size:" + attrs.size());
      }
      




      I invoke 'prepareCreateUser' with the following link:
      <s:button id="createPerson" value="Create Person" action="/createPersonFirstPage.xhtml" propagation="begin"/>
      


      and I have 'createPersonFirstPage.page.xml' with:
      <action execute="#{personActions.prepareCreatePerson}"/>
      


      this action inits te 'attrs' list with few elements.


      In 'createPersonFirstPage.xhtml I have a form which modifies the some of the 'personActions.attrs' and a button such as:

      <h:commandButton id="secondPage" value="Continue" action="/createPersonSecondPage.xhtml" />
      




      createPersonSecondPage.xhtml has a button such as:
      <h:commandButton id="save" value="Save" action="#{personActions.createPreson}"
      


      In 'createPersonSecondPage.page.xml' I have:
      <navigation from-action="#{personActions.createPerson}">
       <end-conversation/>
       <redirect view-id="/Home.xhtml"/>
      </navigation>
      





      The strange is that when 'personActions.createPerson' is invoked 'attrs' list has NO elements. so even though the conversation has started at the first button the data is not available anymore (the conversation Id keeps being the same for all pages)


      What makes is extremely strange is if I access the 'attrs' list in the second page (createPersonSecondPage.xhtml) (even like: <h:outputText value="#{personActions.attrs}/> I can see the elements and when the 'Save' button is pressed the elements are available!



      What causes the data not to be kept? and why accessing the 'attrs' list in the second page makes seam to keep the elements within the list?



      Thanks,

      Asaf.