It’s generally recommended in seam applications that Facelets be used instead of JSP.  JSP pages are processed by the JSP container at the same time as they’re processed by the JSF engine which can cause conflicts.  Performance is also improved when the JSP engine isn’t used.  Facelets is a templating framework that also gives access to XHTML tags and extra debugging support.

It’s also recommended that you add seam’s UI tags which allow the use of Hibernate’s validator annotations and provide conversation and business process management along with other extra tags.

To enable these you need to edit your configuration files and add some jar files.

Add required jar files:
WEB-INF/lib:
jsf-facelets.jar
jboss-seam-ui.jar
jboss-seam-debug.jar

Add el-api.jar and el-ri.jar to the ear file so they can be used by both your war and jar files.  Make an entry in the application.xml file to make the jars available on the ear classpath.

META-INF/application.xml


el-api.jar


el-ri.jar

Add a View Handler:
The view handler renders html pages from facelets pages and templates.

WEB-INF/faces-config.xml


org.jboss.seam.ui.facelets.SeamFaceletViewHandler

Update the web.xml so that the facelets suffix .xhtml will be used for web pages.

WEB-INF/web.xml

javax.faces.DEFAULT_SUFFIX .xhtml

Add the Filter and Resource Servlet:
The SeamFilter supports JSF redirects, error pages and file uploads.  The resource servlet gives access to images and css files in jboss-seam-ui.jar and gives direct access to seam components from javascript.  You add these to your web.xml.

WEB-INF/web.xml


Seam Resource Servlet
org.jboss.seam.servlet.SeamResourceServlet


Seam Resource Servlet
/seam/resource/*


Seam Filter
org.jboss.seam.servlet.SeamFilter


Seam Filter
/*

You can now use .xhtml pages in your application and make use of the seam ui tags.

%d bloggers like this: