JSF-带有参数的调用方法(tomcat6) [英] JSF - call method with parameter (tomcat6)
问题描述
我正在尝试在tomcat6上运行我的项目(通常在tomcat7上运行).但是JSF现在无法调用带有参数的方法,例如
I'm trying to run my project (normally working on tomcat7) on tomcat6. But JSF can't call methods with parameters now, e.g.
<h:commandLink action="#{bean.setpage('index')}"/>
它在Tomcat7上正常工作.
It works normally on Tomcat7..
是否可以在tomcat6上调用带有参数的方法?
Is it possible to call method with parameter on tomcat6?
更新:以下两个答案都是正确的,而且我还必须更新 context.xml :
UPDATE: both answers bellow are correct, and i also had to update context.xml:
<context-param>
<param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
推荐答案
如果使用的容器完全支持JSF 2.0,则可以直接进行
If you are using a container which supports JSF 2.0 completely, you can directly do
<h:commandLink action="#{bean.setpage('index')}"/>
.
否则,您必须使用f:param
或f:attribute
.我认为Tomcat 7完全支持jsf 2,但是Tomcat 6不支持开箱即用.因此,您必须添加jstl-api-1.2.jar
,jstl-impl-1.2.jar
和el-impl-2.2.jar
库才能使其在Tomcat 6上运行.
Else you have to use f:param
or f:attribute
. I think Tomcat 7 supports jsf 2 completely but Tomcat 6 does not support out of the box. So you have to add jstl-api-1.2.jar
, jstl-impl-1.2.jar
and el-impl-2.2.jar
libraries to make it work on Tomcat 6.
这篇关于JSF-带有参数的调用方法(tomcat6)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!