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.

This was last published in December 2010

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudApplications

SearchSOA

SearchSoftwareQuality

SearchFinancialApplications

SearchSAP

SearchManufacturingERP

Close