Using Facelets along with JSP in a JSF application
May 28, 2008 | 2 Minute Read
This post was originally posted on
my old blog .
I wanted to use Facelets for some pages in an existing JSP/JSF application.
To achieve this I had to perform the following steps:
Download Facelets and copy the jsf-facelets.jar into your WEB-INF/lib directory
If you use maven you can include the following dependency in your pom:
< dependency >
< groupId > com.sun.facelets</ groupId >
< artifactId > jsf-facelets</ artifactId >
< version > 1.1.14</ version >
</ dependency >
Add the FaceletViewHandler to the faces-config.xml file.
<application>
...
<view-handler>
com.sun.facelets.FaceletViewHandler
</view-handler>
</application>
Define which pages should be handled by Facelets, i.e. urls ending with '.xhtml'. Add the following snippet to your web.xml:
< context-param >
< param-name > facelets.VIEW_MAPPINGS</ param-name >
< param-value > *.xhtml</ param-value >
</ context-param >
For a useful debug-screen, you should also add the following snippet to your web.xml:
< context-param >
< param-name > facelets.DEVELOPMENT</ param-name >
< param-value > true</ param-value >
</ context-param >
Please enable JavaScript to view the comments
powered by Disqus.