You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 17 Members of 4546 |
| Forum: Seam Users |
19. Aug 2008, 17:34 CET | Link |
Is there any way to effect a Conversation.endAndRedirect in pages.xml? For example:
<page view-id="page1.xhtml" conversation-required="true">
<navigation from-action="#{contactManager.newContact}">
<rule if-outcome="success">
<begin-conversation nested="true"/>
<render view-id="newContact.xhtml"/>
</rule>
</navigation>
</page>
<page view-id="page2.xhtml" conversation-required="true">
<navigation from-action="#{contactManager.newContact}">
<rule if-outcome="success">
<begin-conversation nested="true"/>
<render view-id="newContact.xhtml"/>
</rule>
</navigation>
</page>
<page view-id="newContact.xhtml" conversation-required="true">
<navigation from-action="#{contactManager.saveNewContact}">
<rule if-outcome="success">
<!-- endAndRedirect to go back to either page1.xhtml or page2.xhtml depending on who called me -->
</rule>
</navigation>
</page>
Note that the following do not work:
<end-conversation/> <redirect/>
Nor:
<end-conversation before-redirect="true"/> <redirect/>
One way I can think of (sort of hackish) would be to use the if attribute of <rule> to invoke a backing bean method that does nothing but call Conversation.instance().endAndRedirect() and return true, but that breaks the if-outcome paradigm that I'm using. Any other suggestions?
Thanks, Jesse
another hack would be to do something like this:
<navigation from-action="#{contactManager.saveNewContact}" evaluate="#{conversation.endAndRedirect()}"> <!--If a redirect does not occur redirect to a default page --> <rule if-outcome="false"> <redirect view-id="/someotherpage.xhtml" /> </rule> </navigation>