Thursday, March 24, 2011

What is the standard way to handle url-mapping for JavaServer Faces?

All the tutorials I have seen seem to use *.jsf, *.faces, or /<directory_name>/* for the url-pattern in the Java Server faces servlet mapping. Is there some official sun-recommended naming convention or de-facto standard?

From stackoverflow
  • The recommended conventions are in the JSF 1.2 specification.

    Section 10.1.2:

    When using prefix mapping, the following mapping is recommended, but not required:

    <servlet-mapping>
    <servlet-name> faces-servlet-name </servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    

    When using extension mapping the following mapping is recommended, but not required:

    <servlet-mapping>
    <servlet-name> faces-servlet-name </servlet-name>
    <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    
    Alex Argo : I edited the question to include '.jsf' so you may want to edit the part of the question where you say 'Those' are the recommended conventions. Thanks for finding that though.

0 comments:

Post a Comment