We are integrating new application with existing JSP application and trying to re use some of existing functionality.
I have a navigation rule in faces-navigation.xml like
<from-view-id>/WEB-INF/jsp/admin/login.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/WEB-INF/jsp/admin/welcome.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>admin</from-outcome>
<to-view-id>/WEB-INF/jsp/admin/dashaboard.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
In my jsp I am trying to call this definition like
<a href="/WEB-INF/jsp/admin/login.xhtml">Admin login </a>
When I click on “Admin Login”, I get page not found exception.
Is there another way to call this view ?
Files in
/WEB-INFare not publicly accessible (i.e. the enduser can’t open any files in/WEB-INFdirectly by entering its bare URL in browser’s address bar). They are only accessible by a servlet which does aRequestDispatcher#forward()on the file in/WEB-INFfolder. The old webapp code setup was apparently using such a servlet, either homegrown or from a different MVC framework.You should be moving those pages to outside the
/WEB-INFfolder. I would by the way also remove the misleading/jsppart from the path as those files are not JSP files at all. Given the.xhtmlextension, you are instead actually using its successor Facelets.By the way, navigation rules are obsolete since JSF 2.0 thanks to the new “implicit navigation” feature. Perhaps you was focusing too much at JSF 1.x targeted books/tutorials while learning JSF?