-
1. Re: How to change pages.xml to control page flow
piotr.sobczyk Jan 30, 2010 9:46 AM (in response to granite2009)It's simple indeed :). You have a fragment:
<navigation> <rule if-outcome="login"> <redirect view-id="/login2.xhtml"/> </rule> </navigation>
You have to take care that the button/link that invokes navigation is:
- <h:button action=
login
/> - <h:button action=
#{someBean.someAction}
/> - where someAction return String valuelogin
- <s:button view=
/login2.xhtml
/> - then you don't need navigation at all
- <h:button action=
-
2. Re: How to change pages.xml to control page flow
granite2009 Feb 1, 2010 7:13 AM (in response to granite2009)Thanks for you reply. That's what I found from the documentation. It did not work for me. I wasted 2 weeks on this. That's what I come up.
1. There is a page named login.page.xml in the view folder that control the page flow. This is not documented in Seam 2.2. When I changed from /home.xhtml to /login2.xhtml, it worked.
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns="http://jboss.com/products/seam/pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd">
<navigation from-action="#{identity.login}">
<rule if="#{identity.loggedIn}">
<redirect view-id="/home.xhtml"/>
</rule>
</navigation>
</page>
2. I can control page flow if my bean return a page id, ie /login2.xhtml. This is not good since the page flow is hard coded in the bean.
I just which this login.page.xml is documented. When it is a good time to use individual page control of pages??? -
3. Re: How to change pages.xml to control page flow
piotr.sobczyk Feb 1, 2010 11:12 AM (in response to granite2009)1.
There is a page named login.page.xml in the view folder that control the page flowAre login.page.xml and login.xhtml files in the same directory? There is a possibility to use many *.page.xml files for individual pages instead of one pages.xml descriptor. But you need to be sure that:
- both page and navigation descriptor for it are in the same directory
- page and descriptor have the same name except of extension
For example you can have a directory tree:
- Pages
- mypage.xhtml
- mypage.page.xml
But maybe you should start from pages.xml global descriptor if something goes wrong - it's simplier case.
The xml code you pasted seems to be correct.
2. Yeah, it's rather a bad practice.
When it is a good time to use individual page control of pages???you mean using *.page.xml instead of pages.xml? It really depends of your own preferences. But in my opinion you should choose one and keep it strictly, don't use both in the same application. *.page.xml allows you quickly find descriptor for some specific page you just type page name in "open resource" view in your IDE and you quickly found page descriptor instead of searching through one big pages.xml file.