对于commandLink和commandButton,我有相同的操作。但是,commandLink的工作方式与预期的一样。但在commandButton中,没有发生任何动作。我漏掉语法了吗?
<p:commandLink value="Submit" action="#{beanController.getStr(strSearch)}" ajax="false"/>
<p:commandButton value="Submit" actionListener="#{beanController.getStr(strSearch)}" ajax="false"/> 发布于 2016-04-18 14:11:54
如果您打算进行导航,您应该在您的action中使用actionListener而不是actionListener,因此:
<p:commandButton value="Submit" action="#{beanController.getStr(strSearch)}" ajax="false"/>发布于 2016-04-18 12:09:47
commandButton按钮生成HTML <input type="submit">元素,commandLink生成HTML <a>,而comandButton用于提交表单,而命令链接用于提交链接,因此我建议您检查是否存在嵌套表单,或者代码中是否存在多个表单,或者表单提交中是否存在其他问题,如果您随后可以发布代码的话。
https://stackoverflow.com/questions/36692912
复制相似问题