This content has been marked as final.
Show 2 replies
-
1. Re: Request4Advice: Defining ProcessInstance Var's in Pagefl
mgombocz Feb 27, 2007 9:14 AM (in response to mgombocz)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. -
2. Re: Request4Advice: Defining ProcessInstance Var's in Pagefl
gavin.king Feb 27, 2007 10:17 AM (in response to mgombocz)"processInstance" is the ProcessInstance associated with the current business process, not the one for the pageflow.