[jboss-user] [JBoss Seam] - How to run a page action only once? or How to maintain the c
grettke_spdr
do-not-reply at jboss.com
Mon Jun 25 16:52:08 EDT 2007
Hi folks,
We've got a single requirement in our app where the user can come in on a RESTful URL. The idea is that they make a request and then leave, there is no more interaction. Originally I set this up as a single page with an action. However, I didn't know how to specify that the action only be executed once, so it got run each time the page was submitted after validation errors for example. I ended up coding around it by maintaining state in the component, but that was hacky, as the component didn't need to maintain anything beyond page conversations.
My solution was to create a restful url whose sole purpose in life is to jumpstart a component only once:
| <page view-id="/prepareInspectionRequest.xhtml"
| action="#{inspectionRequestAction.preparePage}">
| <param name="accountNumber"
| value="#{inspectionRequestForm.accountNumber}"/>
| <param name="userProfile"
| value="#{inspectionRequestForm.userProfile}"/>
|
| <navigation from-action="#{inspectionRequestAction.preparePage}">
| <rule if="#{inspectionRequestAction.validRequest}">
| <redirect view-id="/inspectionRequest.xhtml"/>
| </rule>
| <rule if="#{not inspectionRequestAction.validRequest}">
| <redirect view-id="/message.xhtml"/>
| </rule>
| </navigation>
| </page>
|
Is this the best approach?
The conversation scopes of these components defaults to page, which could be fine. After the redirect, the component has lost its state. How to redirect and maintain "page conversation" state.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4057500#4057500
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4057500
More information about the jboss-user
mailing list