Jsf 2 JSF Concat字符串和方法

Jsf 2 JSF Concat字符串和方法,jsf-2,el,Jsf 2,El,如何在方法表达式的结果上显示字符串? 下面的方法不起作用 <h:commandButton action="/product.xhtml?product=#{productBean.product} "> </h:commandButton> 这确实不是有效的方法表达式。如果要调用某些业务操作,则需要在返回值中包含/product.xhtml?product= <h:commandButton value="View" action="#{productBean

如何在方法表达式的结果上显示字符串? 下面的方法不起作用

<h:commandButton action="/product.xhtml?product=#{productBean.product} ">  </h:commandButton>

这确实不是有效的方法表达式。如果要调用某些业务操作,则需要在返回值中包含
/product.xhtml?product=

<h:commandButton value="View" action="#{productBean.view}" />
(此
faces redirect=true
将使其成为一个重定向,这很可能是您在此处尝试实现的)

或者,如果您根本不需要调用业务操作,请使用

<h:button value="View" outcome="/product.xhtml?product=#{productBean.product}" />

或者,如果它是一个非数字字符串,因此需要进行URL编码,则将其嵌套为


另见:
<h:button value="View" outcome="/product.xhtml?product=#{productBean.product}" />
<h:button value="View" outcome="/product.xhtml">
    <f:param name="product" value="#{productBean.product}" />
</h:button>