Setup:
I am on MyFaces 1.1 on Tomcat 5.5 with the facelet libraries from the Exadel
project wizard added.
Any time I have an action with from-outcome but no from-action specified,
everything works as expected. I can route to whichever view. When I add the
from-action tag to my configuration, it calls my action and action listeners
fine, but the requesting page is always reloaded (I never go to a new view).
I have verified my "h:commandLink" components are within my "h:form" tag.
Hierarchy:
jsp:root/jsp:text/ui:composition/ui:define/h:form/table/tr/td/h:commandLink
Command link code:
...
<h:commandLink value="mylink" action="#{userBean.saveCurrentUser}"/>
<t:saveState id="adminUserBean" value="#{userBean}"/>
</h:form>
...
(t = tomahawk namespace)
My template is nothing more than a bunch of div tags & HTML table elements,
no JSF logic really.
Relevant tags in my faces-config.xml:
...
<managed-bean>
<managed-bean-name>userBean</managed-bean-name>
<managed-bean-class>mypackage.UserBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/administration/*</from-view-id>
<navigation-case>
<from-outcome>edit-user</from-outcome>
<to-view-id>/administration/user/edit.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{userBean.saveCurrentUser}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/administration/user/list.jsp</to-view-id>
</navigation-case>
...
Code of saveCurrentUser:
public String saveCurrentUser()
{
...
try
{
...
return "success";
}
catch (Exception ex)
{
...(logging)...
return "failed";
}
}
...
The action to edit the user that contains an action listener works.
(navigate from /administration/users/list.jsp to
/administration/user/edit.jsp).
The action to save the user successfully saves the user from what I can see
(log is clear), but the page stays at /administration/user/edit.jsp instead
of going back to the list.jsp.
I am using *.jsp instead of something like *.xhtml since Excadel doesn't
support anything but *.jsp at this point in time.
I cannot figure out why the "from-action" is causing the navigation to fail.
No matter what I try, I get the same results. I attempted to update my
facelets libraries, but I messed up along the way and was getting
incompatible classes across the jar files, so I just rolled back.
The navigation handler seems to think the action is always null as seen in
the log4j output:
113121 DEBUG [http-8080-Processor4]
org.apache.myfaces.application.NavigationHandlerImpl - handleNavigation
fromAction=null outcome=success no matching navigation-case found, staying
on current ViewRoot
Any assistance is appreciated. Thanks,
Andrew
BTW - this was orginally posted at the Java Forums, but the forums seem to
be horrible in getting JSF/MyFaces support.
http://forum.java.sun.com/thread.jspa?threadID=667310