ICEfaces : Best Practices
¶ Best PracticesThe page contains hints, tips, and best practice recommendations for developing JavaServer Faces (JSF) applications with ICEfaces 2. ¶ Servlet Mappings - Extension vs PathWhen using JSF, you need to map certain incoming requests to the FacesServlet. The typical scenario is to map the virtual .jsf extension. In the application's web.xml file, you would do something like this:
Assuming the above configuration, each request to the application that has the .jsf extension is then handled by the FacesServlet:
As an alternative to mapping a virtual extension, you also have the option to use a virtual path mapping like this:
In this case, any requests that contain /faces/ in the path are routed through the FacesServlet:
A drawback of using the path mapping is that it casts a broader net. With extension mapping, it's typically only your pages (.xhtml) that will be handled by the FacesServlet, which is generally what you want. Static resources like images and CSS files are served more efficiently by the web server directly. With path mapping, relative references to resources can have the /faces/ mapping added to the path and request for those resources trigger a JSF lifecycle and add additional processing overhead. The bottom line is that, if possible, use extension mapping rather than path mapping for you JSF applications. |
| Copyright © 2016 ICEsoft Technologies, Canada Corp. |