<h:commandButton value ="...?userId =#{...}"有什么问题

Tha*_*ham 3 jsf

整个语法如下

<h:commandLink action="CustomerDetails?faces-redirect=true&amp;customerId=#{item.id}" value="#{item.name}"/>
Run Code Online (Sandbox Code Playgroud)

这是在dataTable中,因此解释了使用if item.但是上面的代码给了我

Not a Valid Method Expression: CustomerDetails?faces-redirect=true&customerId=#{item.id}
Run Code Online (Sandbox Code Playgroud)

它似乎不允许我连接字符串和EL表达式.做了很多内部value属性,必须是action属性的东西.有人为此得到了解决方案吗?

Nic*_*ick 5

尝试在h:link中使用f:param来设置customerId,这是设置查询参数的规范方法.所以:

<h:link outcome="CustomerDetails" value="#{item.name}">
    <f:param name="customerId" value="#{item.id}" />
</h:link>
Run Code Online (Sandbox Code Playgroud)