12

我正在尝试将 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>

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

Class org.springframework.web.jsf.el.SpringBeanFacesELResolver must extend the type javax.el.ELResolver

有任何想法吗?

4

8 回答 8

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>
于 2011-07-29T15:11:46.007 回答
2

这可能是 ClassLoader 配置问题。如果 SpringBeanFacesELResolver 的父类与执行引导的 JSF 类使用的 ClassLoader 不同,则检查它是否是 ELResolver 的实例将失败。

如果您在全局类路径中有 META-INF/faces-config.xml,则可能会发生此类问题,但我想可能还有其他原因。

如果您发布有关正在使用的容器、应用程序的类加载器策略以及放置任何第三方库(例如 Facelets 和 Spring 库)的位置的信息,将会有所帮助。

于 2009-07-29T15:52:34.643 回答
2

要解决此类问题,您应该使用扩展项目,javax prefix因为Class ELResolver它是一个abstract classunder javax.el package

这是代码:

    <application>
      <javax.el-resolver>
        org.springframework.web.jsf.el.SpringBeanFacesELResolver
      </javax.el-resolver>      
    </application>

您可以通过链接获得有关 ELResolver 类的更多信息。

于 2017-11-13T08:04:41.517 回答
1

配置您的项目方面。与您的本地服务器一起运行

在此处输入图像描述

于 2016-10-10T18:19:59.797 回答
0

请检查您在应用程序中使用的 JAR 文件。再次在应用程序中设置类路径。我认为这是因为应用程序类路径中的类冲突。

于 2009-08-06T07:45:25.993 回答
0

好吧,我的问题消失了,将这些行替换为:

<!-- variable/property resolver registration -->
    <application>
        <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
        <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
    </application>

希望能帮助到你!

于 2009-08-18T08:08:52.410 回答
0

谢谢#saadi90,我从mvnrepository.com找到了这个,它解决了问题:

<dependency>
   <groupId>org.glassfish.web</groupId>
   <artifactId>el-impl</artifactId>
   <version>2.2</version>
</dependency>
于 2015-12-29T15:25:00.870 回答
-1

您需要el-impl依赖项

于 2015-04-21T12:59:46.533 回答