Reputation: 55
I am using Netbeans 7.0, Glassfish 3.1, JSF 2.0 I am trying to navigate from one view to another in a step-wise user registration process (with three steps). Each step corresponds to a view and these views are in different folders but all have the same name, i.e register.xhtml. i have tried implicit navigation whereby i specify the absolute path of the views in a managed bean event listener and also using the faces-config.xml navigation cases.
The problem is that i can navigate from the first step/view to the next step/view without a problem. Navigating to the third view however results in a com.sun.faces.context.FacesFileNotFoundException
the file structure is like
/extensions/assm/registration/individual/register.xhtml
/extensions/assm/registration/address/register.xhtml
/extensions/assm/registration/systemuser/register.xhtml
extract of faces-config.xml for navigating from address to systemuser
<navigation-rule>
<from-view-id></from-view-id>
<navigation-case>
<from-outcome>gotosystemuser</from-outcome>
<to-view-id>/extensions/aasm/registration/systemuser/register.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
anyone out there know where i am getting it wrong?
Upvotes: 0
Views: 3544
Reputation: 51030
com.sun.faces.context.FacesFileNotFoundException
means that JSF is not able to locate the view. The view id
you have specified in the navigation-rule
is not good (somehow).
A view is identified by the path with everything after the context root
, including the /
at the beginning.
But you also have to include the URL pattern
that's mapped with the Faces Servlet
in web.xml
.
e.g. if in your web.xml if you have
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/jsf/*</url-pattern>
then you have to also include that as the View ID
. So, with the view id will be
/jsf/folder1/folder2/page.xhtml
But with JSF 2.0 you don't need to do all that navigation-rule in the faces-config
file.
In JSF 2.0 to navigate to another page all you need to do is return the view id from the action method.
@ManagedBean
@ViewScoped
public class MyBean {
public String axnMethod() {
return "view-id"; //this will result in navigation to view represented by view-id
}
Upvotes: 2