开发者

Multiple <application> tags in faces-config.xml

开发者 https://www.devze.com 2022-12-13 04:10 出处:网络
It\'s a very simple question: can faces-config.xml file have multipletags (more like SHOULD they have)? I\'m working in a JSF project and the faces-config.xml file has something like this:

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 开发者_如何学Gothis could be one of the causes of my problems (I kind of think the multpiple view handlers are involved).


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消