struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mraible <>
Subject Re: Can I integrate Struts 2 + JSF and Facelets?
Date Thu, 26 Jul 2007 17:35:42 GMT

Thanks for your help. I was able to get it working with Sun's RI + Facelets.
I'm confident I could get it working with MyFaces 1.2 as well - but since
they require a JSP 2.1 container (Sun's RI doesn't), I'll stick with the RI.

Here's the two ways I discovered:

1. Create a faces-config.xml file with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns=""


2. Integrate Ajax4JSF (no faces-config.xml required) and add the following
to your web.xml:


There does seem to be a bug with this integration however. The content-type
returned from a Facelets page by default is:

Content-Type: application/xhtml+xml; charset=UTF-8

Since I'm using SiteMesh, my Facelets pages don't get decorated by default.
The workaround seems to be adding the following at the top of my pages:

<f:view contentType="text/html">

This doesn't happen when using JSP for the view. It also doesn't happen when
I use JSF standalone.


Laurie Harper wrote:
> mraible wrote:
>> I'm trying to integrate JSF into a Struts 2 prototype. AFAICT, I need to
>> add
>> the struts-jsf-plugin to my pom.xml and add FacesServlet to my web.xml.
>> Are
>> there any other steps needed?
>> I'm using Sun's RI since it run's on Tomcat 5.x with JSP 2.0. How do I
>> tell
>> JSF to use Facelets w/o a faces-config.xml file? Does the plugin only
>> work
>> with MyFaces + JSP?
> The JSF plugin should work with either MyFaces or the RI, and Facelets 
> should work too. I don't think you can get Facelets configured without 
> making the usual additions to web.xml and faces-config.xml, though, so 
> you'll need to do that as normal.
> L.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message