Primefaces - 命令按钮不起作用 [英] Primefaces - commandButton does not work
本文介绍了Primefaces - 命令按钮不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了 commandButton 的问题,它仅在提交类型时才起作用.有人可以看看并告诉我是否有解决方案吗?下面的代码非常简单,并且确实有说明我需要的建议.不执行方法 test().方法 runSubmit 执行成功.
我需要在没有提交的情况下执行测试方法,因为原始页面确实有在提交期间执行的验证,必须在没有提交的情况下执行 test() 方法,因为它是提交之前的初步操作.>
我正在使用 PrimeFaces 4.0、JDK 7、Tomcat 6 和 JSF 2.0 (Apache),但我认为它也在 Mojarra 中发生.
会话:包 com.andre.bean;公共类 AndreBean {公共无效运行提交(){System.out.println("提交执行");}公共字符串测试(){System.out.println("未提交执行");返回真";}}
<小时>
XHTML<html xmlns="http://www.w3.org/1999/xhtml"xmlns:h="http://java.sun.com/jsf/html"xmlns:f="http://java.sun.com/jsf/core"xmlns:p="http://primefaces.org/ui"><h:头></h:head><h:form id="test"><p:commandButton id="ns" value="not submit" type="button" action="#{andreBean.test}" ajax="false"></p:commandButton><p:commandButton id="s" value="submit" action="#{andreBean.runSubmit}"></p:commandButton></h:form>