3

我正在做一个将在 Websphere 上运行的项目。

我在这个项目中使用 JSF/Facelets/Richfaces。

我想使用 JBoss EL 实现,因为它允许使用来自 EL 等的参数调用方法。

...通常这是通过获取 JBoss EL jar 然后将其放入 web.xml 来完成的:

 <context-param>
  <param-name>com.sun.faces.expressionFactory</param-name>
  <param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
 </context-param>

但是这不起作用......我不知道它是Websphere的问题还是......???

转到页面时,我得到一个堆栈跟踪,说它无法解析我已向方法传递参数的 EL:

<a4j:commandLink value="Delete" action="#{mcsaAdmin.deleteLanguage(1234)}" />

查看堆栈跟踪,它似乎仍在使用标准的 sun EL:

Caused by: javax.el.ELException: Error Parsing: #{mcsaAdmin.deleteLanguage(1234)}
 at com.sun.el.lang.ExpressionBuilder.createNodeInternal(Unknown Source)
 at com.sun.el.lang.ExpressionBuilder.build(Unknown Source)
 at com.sun.el.lang.ExpressionBuilder.createMethodExpression(Unknown Source)
 at com.sun.el.ExpressionFactoryImpl.createMethodExpression(Unknown Source)
 at com.sun.facelets.tag.TagAttribute.getMethodExpression(TagAttribute.java:141)

请注意上面指定的 'com.sun.el.E​​xpressionFactoryImpl' 而不是 'org.jboss.el.E​​xpressionFactoryImpl' ...

我在做一些明显错误的事情吗?任何人都有任何想法......我正在使用majorra项目的标准JSF实现或sun网站和richfaces 3.1.4和facelets 1.1.14上提供的任何东西。

4

4 回答 4

1

也许问题不在于 Websphere,而在于 JSF 实现,因为“com.sun.faces.expressionFactory”是特定于 JSF 实现的。当我使用正确参数名称为“org.apache.myfaces.EXPRESSION_FACTORY”的 MyFaces 时,我遇到了同样的问题。

于 2010-03-31T10:29:33.527 回答
0

Have you set the classloader correct? In websphere you have to set the class loader in multiple settings. Set the web-module classloader to Parent last and the application class loader to parent last.

If both are not on parent last, your own jars might not be used, but instead the ones provided with websphere.

于 2012-12-31T10:51:02.047 回答
0

这可能是由于类路径范围问题。你在哪里复制了你的 jboss el jar?

于 2010-01-06T23:41:56.013 回答
0

你说的对。在类路径/WEB-INF/lib中包含jboss-el.jar并在 web.xml 中定义

<context-param>
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>

但是有一些限制。看这里

如果您想深入了解表达式语言,请参阅使用自定义 ELResolver 扩展 Java EE 统一表达式语言表达式语言常见问题解答

问候,

于 2010-01-07T01:09:30.347 回答