I have a list of .xhtml pages that I keep in my /src/main/webapp/pages/ folder. Now I want to create hyperlinks to them. Currently the only one that works is the default home page: /src/main/webapp/pages/default.xhtml.
<!-- Welcome page -->
<welcome-file-list>
<welcome-file>/pages/default.xhtml</welcome-file>
</welcome-file-list>
<!-- JSF mapping -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map these files with JSF -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
For the others, if I have a link such as:
<a href="/pages/page1.xhtml">Page 1</a>
I get the following error:
/page1.xhtml Not Found in ExternalContext as a Resource
My question is: How do I specify the page I want in a href relative to the webapp root.