[jboss-user] [JBoss Seam] - Re: Request4Advice: Defining ProcessInstance Var's in Pagefl
mgombocz
do-not-reply at jboss.com
Tue Feb 27 09:14:43 EST 2007
To whom it may concern.
So, here's a solution (a few hours of sleep helped...):
First of all here's my pageflow where I initialize and update two process variables named "totalPages" and "currentPage":
<pageflow-definition name="createUser">
| <event type="process-start" >
| <script>
| <expression>
| int total = 2;
| int current = 1;
| </expression>
| <variable name="totalPages" mapped-name="total" access="write" />
| <variable name="currentPage" mapped-name="current" access="write" />
| </script>
| </event>
|
| <start-page name="createUser" view-id="/editUser.xhtml">
| <redirect />
|
| <transition name="cancel" to="cancelled" />
| <transition name="save" to="evaluate">
| </transition>
| </start-page>
|
| <decision name="evaluate"
| expression="#{userManager.usernameUnique}">
|
| <transition name="true" to="enterRoles">
| <action expression="#{userManager.save}" />
| <script>
| <expression>
| current++;
| </expression>
| <variable name="currentPage" mapped-name="current" access="read,write" />
| </script>
| </transition>
|
| <transition name="false" to="createUser" />
| </decision>
|
| <page name="enterRoles" view-id="/editUserRoles.xhtml">
| <redirect />
|
| <transition name="save" to="finished">
| <action expression="#{userManager.flush}" />
| </transition>
|
| <transition name="previous" to="createUser">
| <script>
| <expression>
| current--;
| </expression>
| <variable name="currentPage" mapped-name="current" access="read,write" />
| </script>
| </transition>
|
| <transition name="cancel" to="cancelled" />
| </page>
|
| <page name="finished" view-id="/showUser.xhtml">
| <redirect />
| <end-conversation />
| </page>
|
| <page name="cancelled" view-id="/searchUser.xhtml">
| <redirect />
| <end-conversation />
| </page>
|
| </pageflow-definition>
These two variables can then be accessed in the views via:
#{pageflow.processInstance.contextInstance.variables['currentPage']}
| #{pageflow.processInstance.contextInstance.variables['totalPages']}
For whatever reason using context variable "processInstance" directly does not work, like
#{processInstance.contextInstance.variables['currentPage']}
|
Cheers.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4023039#4023039
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4023039
More information about the jboss-user
mailing list