且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将参数传递给h:outputtext标记中的方法

更新时间:2022-05-09 00:04:37

除语法错误(您永远不能嵌套#{#{}}之类的EL表达式)之外,以下内容在EL 2.2中有效,而EL 2.2又是Servlet的一部分3.0/Java EE 6:

Apart from the syntax error (you can never nest EL expressions like as #{#{}}), the following is valid in EL 2.2 which is in turn part of Servlet 3.0 / Java EE 6:

<h:outputText value="#{bean.getValue(item.product).component.address}" />

因此,如果您具有与Servlet 3.0兼容的目标运行时环境(Tomcat 7,Glassfish 3,JBoss 6等)和与Servlet 3.0兼容的web.xml,则可以使用此类参数调用非getter方法.

So if you have a Servlet 3.0 compatible target runtime (Tomcat 7, Glassfish 3, JBoss 6, etc) with a Servlet 3.0 compatible web.xml, then you can invoke non-getter methods with arguments like this.

但是,根据您的问题历史记录,您正在使用JSF 1.2,并且很有可能您还将目标对准了较旧的容器,而上面的容器不起作用.如果它是Servlet 2.5容器,则可以使用 JBoss EL 可以使该EL语法起作用.

However, based on your question history you're using JSF 1.2 and the chance is big that you're also targeting an older container where the above wouldn't work. If it is a Servlet 2.5 container, then you could use JBoss EL to get this EL syntax to work.