[jboss-user] [JBoss Seam] - Very strange conversation behavior

trouby do-not-reply at jboss.com
Wed Dec 26 12:25:57 EST 2007

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?



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

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

More information about the jboss-user mailing list