commandButton の問題に直面しています。タイプが送信の場合にのみ機能します。誰かが見て、その解決策があるかどうか教えてもらえますか? 以下のコードは非常にシンプルで、必要なものを説明するための提案があります。メソッド test() は実行されません。メソッド runSubmit が正常に実行されました。
元のページには送信中に実行される検証があるため、送信せずにテストメソッドを実行する必要があります.test()メソッドは、送信前の予備操作であるため、送信せずに実行する必要があります.
私は PrimeFaces 4.0、JDK 7、Tomcat 6、および JSF 2.0 (Apache) を使用していますが、Mojarra でも同様に発生していると思います。
SESSION:
package com.andre.bean;
public class AndreBean {
public void runSubmit() {
System.out.println("Submit executed");
}
public String test() {
System.out.println("Not submit executed");
return "true";
}
}
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:head>
</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>
</html>
どうもありがとうアンドレ