This content has been marked as final.
Show 3 replies
-
1. Re: Page navigation - better approach
danielrowe Jan 13, 2010 10:30 PM (in response to brunolellis)I use an "f:param" inside Seam link -- the f:param sets the name of the "from" page.
So, for example, in your case, it might look like this:
sales.xhtml:
<s:link id="foo"
value="Foobar"
view="/customers.xhtml">
<f:param name="fromPage" value="sales"/>
</s:link>
customers.xhtml:
<s:button
id="back"
value="Back"
view="/#{empty fromPage ? 'someDefaultPage' : fromPage}.xhtml">
</s:button>
pages.xml:
<page view-id="/customers.xhtml" login-required="true">
<param name="fromPage"/>
</page> -
2. Re: Page navigation - better approach
brunolellis Jan 13, 2010 10:51 PM (in response to brunolellis)I will try this!
Thanks!
-
3. Re: Page navigation - better approach
brunolellis Jan 14, 2010 2:20 AM (in response to brunolellis)It works:
pages.xml
<page view-id="/teste/*"> <begin-conversation join="true" /> <param name="fromPage" value="#{testeBean.fromPage}" /> </page> <page view-id="/teste/page1.xhtml"> <navigation> <rule if-outcome="page_3"> <redirect view-id="/teste/page3.xhtml"> <param name="fromPage" value="page_1" /> </redirect> </rule> </navigation> </page> <page view-id="/teste/page2.xhtml"> <navigation> <rule if-outcome="page_3"> <redirect view-id="/teste/page3.xhtml"> <param name="fromPage" value="page_2" /> </redirect> </rule> </navigation> </page> <page view-id="/teste/page3.xhtml"> <navigation> <rule if-outcome="page_1"> <redirect view-id="/teste/page1.xhtml"/> </rule> <rule if-outcome="page_2"> <redirect view-id="/teste/page2.xhtml"/> </rule> </navigation> </page>
/teste/page1.xhtml:
<h1>page 1</h1> <h:form> <h:commandLink value="page 3" action="page_3" /> </h:form>
/teste/page2.xhtml:
<h1>page 2</h1> <h:form> <h:commandLink value="page 3" action="page_3" /> </h:form>
/teste/page3.xhtml:
<h:form> from: <h:outputText value="#{fromPage}" /> <h:commandLink value="voltar - back" action="#{testeBean.back}" /> </h:form>
TesteBean.java:
@Name("testeBean") @Scope(ScopeType.CONVERSATION) public class TesteBean implements Serializable { private String fromPage; public String back() { return fromPage; } public String getFromPage() { return fromPage; } public void setFromPage(String fromPage) { this.fromPage = fromPage; } }
and, IMHO, it is easier to understand.