类org.springframework.web.jsf.el.SpringBeanFacesELResolver必须扩展类型javax.el.E​​LResolver

mar*_*s82 10 jsf spring facelets el

我试图将Spring集成到JSF应用程序中.

faces-config.xml,我已经包括这个:

<application>       
  <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
  <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
Run Code Online (Sandbox Code Playgroud)

但它显示了一个我无法摆脱的奇怪警告:

Class org.springframework.web.jsf.el.SpringBeanFacesELResolver must extend the type javax.el.ELResolver
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

Luc*_*cas 12

spring文档中,您将看到org.springframework.web.jsf.el.SpringBeanFacesELResolver:

首先委托Spring的'业务上下文'WebApplicationContext,然后委托底层JSF实现的默认解析器

对于org.springframework.web.jsf.DelegatingVariableResolver:

将首先将值查找委托给底层JSF实现的默认解析器,然后委托给Spring的"业务上下文"WebApplicationContext

如您所见,行为非常不同.如果你不关心订单,你很好,但如果你确实打算使用org.springframework.web.jsf.el.SpringBeanFacesELResolver,那么你所要做的就是确保你的el-api.jar版本依赖项与您的spring版本兼容.对我来说,我有这个(在我的maven pom中):

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>3.0.5.RELEASE</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>el-api</artifactId>
    <version>6.0.32</version>
    <type>jar</type>
    <scope>provided</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)


mar*_*s82 0

好吧,我的问题消失了,用以下代码替换这些行:

<!-- variable/property resolver registration -->
    <application>
        <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
        <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
    </application>
Run Code Online (Sandbox Code Playgroud)

希望能帮助到你!