title: Primefaces - commandButton does not work
body: <p>I am facing a problem with commandButton, it is working only when the type is submit. Can someone take a look and let me know if there is a solution for that? The code below is very simple and does have the the propose to illustrate what I need. The method test() is not executed. Method runSubmit is executed successfully.</p>
  
  <p>I need that test method is executed without a submit as the original page does have validations that are executed during the submit, test() method must be executed without a submit as it is a preliminary operation before of the submit.</p>
  
  <p>I am using PrimeFaces 4.0, JDK 7, Tomcat 6 and JSF 2.0 (Apache), however I think it is happening in Mojarra as well.</p>
  
  <pre><code>    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";
  }
  
  }
  </code></pre>
  
  <hr>
  
  <pre><code>XHTML
  
  &lt;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"&gt;
  
  &lt;h:head&gt; 
  &lt;/h:head&gt;
  
  &lt;h:form id="test"&gt;
  &lt;p:commandButton id="ns" value="not submit" type="button" action="#{andreBean.test}" ajax="false"&gt;&lt;/p:commandButton&gt;
  &lt;p:commandButton id="s" value="submit" action="#{andreBean.runSubmit}"&gt;&lt;/p:commandButton&gt;
  
  &lt;/h:form&gt; 
  
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <p>Thank you very much
  Andre</p>