1
votes

I'm trying to make HellowWorld app with JSF. I make Dynamic web proj, choose JSF v 2.0 for configuration, then Disable library configuration. Then I add jsf-api.jar, jsf-impl.jar, jstl-api.jar and jstl-impl.jar to my lib folder. Then create simple jsp and when try to start it i get The requested resource () is not available. I think it's something with the mapping of the Faces Servlet in web.xml.

2

2 Answers

2
votes

You need to ensure that the FacesServlet is mapped in web.xml and that the request URL (which appears in browser address bar) matches the <url-pattern> of the FacesServlet.

E.g., if you have a simple.jsp file in webcontent and the FacesServlet is mapped on an <url-pattern> of *.jsf, then you need to open it by http://localhost:8080/contextname/simple.jsf.

<servlet>
    <servlet-name>facesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>facesServlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>

Unrelated to the concrete problem: why would you ever prefer the legacy/discouraged JSP over its modern successor Facelets which is the standard view technology since JSF 2.0?

1
votes

The problem here is jsp file shouldn’t be present inside WEB-INF folder move it under web content. This will solve your issue.