How to use javax.faces.FACELETS_SUFFIX parameter in jsf 2

I understood the meaning of the jsf 2.0 context parameters "javax.faces.DEFAULT_SUFFIX" and "javax.faces.FACELETS_VIEW_MAPPINGS" with some examples. But I do not know about the parameter "javax.faces.FACELETS_SUFFIX".

According to the documentation:

javax.faces.FACELETS_SUFFIX ": allow the web application to define an alternative suffix for Facelet-based XHTML pages containing JSF content. If this initialization parameter is not specified, the default value is taken from the value of the DEFAULT_FACELETS_SUFFIX constant, which is" xhtml ".

So, if I want to change the jsf file extension from xhtml to xml, I have the following settings:

<context-param> <param-name>javax.faces.FACELETS_SUFFIX</param-name> <param-value>.xml</param-value> </context-param> 

But when I access the page in a web browser, I get an HTTP 404 error.

If I changed the settings as shown below:

 <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xml</param-value> </context-param> <context-param> <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name> <param-value>*.xml</param-value> </context-param> 

Then, when I access the page in a web browser, it works.

Can someone explain to me what the real value of the parameter "javax.faces.FACELETS_SUFFIX" is?

+4
source share
1 answer

It should look like <context-param> in the webapp web.xml .

For example, if you want to change it from .xhtml to .xml :

 <context-param> <param-name>javax.faces.FACELETS_SUFFIX</param-name> <param-value>.xml</param-value> </context-param> 
+3
source

All Articles