tags:

views:

298

answers:

1

It's a very simple question: can faces-config.xml file have multiple tags (more like SHOULD they have)? I'm working in a JSF project and the faces-config.xml file has something like this:

<application>
 <el-resolver>org.jboss.seam.el.SeamELResolver</el-resolver>
 <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
    <message-bundle>customMessages</message-bundle>
</application>

<application>
 <view-handler>org.rivetlogic.crafter.core.jsf.CrafterFacesViewHandlerImpl</view-handler>
 <el-resolver>org.jboss.seam.ioc.spring.SpringELResolver</el-resolver>
</application>

But I've never seen another JSF application with multiple <application> tags, and maybe this could be one of the causes of my problems (I kind of think the multpiple view handlers are involved).

+1  A: 

From the JSF 1.2 schema:

    <xsd:choice minOccurs="0" maxOccurs="unbounded">
        <xsd:element name="application"
                     type="javaee:faces-config-applicationType"/>

Multiple application elements should be OK, but there aren't any restrictions on the number of view-handler elements within an application element either.

The ViewHandler is pretty fundamental to how JSF works. The ViewHandlers may not be compatible (check their documentation) or they may be sensitive to load order (I don't think it is specified within a faces-config.xml). In the latter case, you can put them in separate documents and use the javax.faces.CONFIG_FILES init parameter to specify processing order (see spec).

McDowell