【发布时间】:2014-03-12 18:15:33
【问题描述】:
我是 JSF 和 primefaces 的新手……我写了一个小代码……我得到了我想要用“h:commandbutton”做的事情,但同样的事情不适用于“p:commandbutton”。这两个东西的功能有什么区别吗?
<h:commandButton value= "enter" actionListener= "#{newJSFManagedBean.show()}"/><br/>
<p:commandButton value= "enter" actionListener= "#{newJSFManagedBean.show()}"/><br/>
我已经尝试了很多东西,但是没有从 p:commandbutton 调用 newjsfmanagedbean.show() 但 h:commandbutton 工作正常。原因是什么:-(?
【问题讨论】:
-
必须在表单内。
-
它在 "h:form" 里面。
-
然后向我们展示整个代码(html + backing bean)
-
尝试使用 action 而不是 actionListener。你也可以试试 ajax="false"。
-
能否请您也分享一下您的 show() 函数?
标签: jsf-2 primefaces commandbutton