seam 3 and jsf navigation (pages.xml)
georges.goebel Apr 19, 2011 4:23 AMHi,
I have some applications using seam 2 and jsf frameworks (mainly icefaces)
I took a look at seam3 and jsf2 and have some difficulties to get a proper navigation to work. In seam2/pages.xml I could have my actions which are referenced in the commandButton have a void return argument. I prefer having as less as possible navigation logic in my beans. So I do not want to return the view id in a save method.
In seam2 that was fine because the whole navigation and security logic was in my pages.xml
<?xml version="1.0" encoding="UTF-8"?>
<pages 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"
login-view-id="/login.xhtml">
<page view-id="/login.xhtml">
<navigation>
<rule if="#{identity.loggedIn}">
<redirect view-id="/main.seam"/>
</rule>
</navigation>
</page>
<page view-id="/modifyVehicule.xhtml" login-required="true">
<begin-conversation join="true"/>
<navigation from-action="#{modifyVehicule.endActionSaveVehicule}">
<redirect view-id="/main.xhtml"/>
</navigation>
<navigation from-action="#{modifyVehicule.endActionCancel}">
<redirect view-id="/main.xhtml"/>
</navigation>
</page>
I tried a simple example in seam3 with the navigation rules in the faces-config.xml, but it does not work as expected.
For example :
The following rule works only if the return type of the create method is a String. The value of the return value is not important.
<navigation-rule>
<from-view-id>/add.xhtml</from-view-id>
<navigation-case>
<from-action>#{vehiculeBean.create}</from-action>
<to-view-id>/view.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
Is it possible to achieve the same behavior of the old seam2/pages.xml with seam3 ?
I checked out the faces module and saw something with the @ViewConfig but I do not know if this would solve my problem.
Thanks for all suggestions
Regards
Georges Goebel