Working with JSPs in JSF 2.0

Working with JSPs in JSF 2.0

If you’ve been working with JavaServer Faces in the past, you’re probably used to working with JSPs as your view technology. Of course, with JSF 2.0, the new push is for developers to use Facelets as their templating technology, and rightly so, as Facelets provide a much more flexible and adaptable mechanism for developing user interfaces.

Of course, with JSF 2.0, the container is going to be looking for xhtml files by default, which isn’t good if you’re still working with JavaServer Pages. But don’t fret, as there’s an easy fix. All you have to do is edit your web.xml file and tell the container that your default view technology should be JSPs.


 <context-param>     <param-name>javax.faces.DEFAULT_SUFFIX</param-name>     <param-value>.jsp</param-value> </context-param>


With that small change, the JSF 2.0 framework will start pulling up JSP files instead of xhtml files, just like it did by default in the previous version.

Dig Deeper on Front-end, back-end and middle-tier frameworks

App Architecture
Software Quality
Cloud Computing