I am new at JSF, so do not assume that it is not some dumb mistake.
I am deploying my webapp, from Eclipse Indigo into JBoss 6.1. I can check that the webapp is deployed in the server because an static index.html file works ok (and changes in it are reflected via web browser).
I have a JSF2 Facelet in pages/NewRequest.jsf, which very little logic (in fact it is plain XHTML):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:body>
Hola mundo again....
</h:body>
</html>
My web.xml is the following (I checked that the FaceServlet is configured)
<?xml version="1.0"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee web-app_3_0.xsd">
<display-name>GesMan</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<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>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>NewRequest.jsf</welcome-file>
</welcome-file-list>
</web-app>
It all looks legit for me, but when I try to access the JSF I only get a 404 error page that tells me that a JSP with the same name that my JSP does not exist. No error is shown neither in the console nor in the server.log file
Could you tell me what I am doing wrong, or how can I get a more specific error information?
The file extension of the actual view file should represent the view technology used (e.g.
.xhtmlor.jsp), not the JSF mapping (e.g..jsf). You should have apages/NewRequest.xhtml, not apages/NewRequest.jsf.Your other problem is that the welcome file can’t represent a mapped (virtual) filename, but must represent an actual filename. So you need
NewRequest.xhtmlthere. But this in turn requires you that you map theFacesServleton exactly that URL pattern.So, all with all, just simplify the
web.xmlas follows:This way you can continue using
.xhtmlin URLs without fiddling with virtual URLs.