Reputation: 989
i start with the programming of a JSF Website. At the moment all files have the .xhtml ending. When i go to http://localhost:8080/myProject/start.jsf everything is all right. But when i rename the file from start.xhtml to start.jsf i became a NoClassDefFound Error.
What is my mistake?
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
Upvotes: 4
Views: 3113
Reputation: 124
It's best to stay with .xhtml because that's the right way to do it, but you can configure it with the javax.faces.DEFAULT_SUFFIX context-param in web.xml.
Upvotes: 0
Reputation: 81587
Why do you want to rename the file start.jsf
? The correct extension of the JSF files are .xhtml
(but you can modify this default extension, as stated by Bozho).
In fact, to be precise, this extension is defined by Facelets (or JSF 2.0, as it natively integrate Facelets), which is different if you use "basic" JSP files.
Upvotes: 1
Reputation: 597026
You have to change the javax.faces.DEFAULT_SUFFIX
parameter (in web.xml)
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jsf</param-value>
</context-param>
However, this is not advisable - either use .xhtml
or .jsp
for your files.
Note that you can use .jsp
with facelets with no problems (if, for example the auto-complete of your IDE doesn't work for .xhtml
).
Also note that:
DEFAULT_SUFFIX
parameter indicates what's the extension of the files.Upvotes: 6