【发布时间】:2014-03-09 11:26:14
【问题描述】:
我想将 GET 参数从 URL 传递给一个方法,该方法通过单击按钮调用。 例如,我有 URL:/someurl/semepage.xhtml?id=1。我的页面上有一个按钮:
<p:commandButton value="say it" action="#{test.sayIt(param['id'])}"/>
bean 看起来像:
@ManagedBean
@ViewScoped
public class Test{
public void sayIt(String value){
System.out.println(value);
}
}
但是当我点击按钮时,它只是没有反应。为什么会这样? 方法甚至没有被调用。
如果我像这里一样静态传递参数:
<p:commandButton value="say it" action="#{test.sayIt('someword')}"/>
一切正常。
【问题讨论】:
标签: jsf jsf-2 primefaces