title: p:commandButton not executing action method
body: <p>I've dug around SO trying to solve this problem and keep on finding my way back to a post (which I can't seem to find again) where BalusC provided a list of likely problems, but I had already implemented the solutions to what problems seemed like they applied to me. The situation is that inside of my .xhtml file I have a Primefaces commandButton attempting to call a backing Bean method while setting some bean properties with f:setPropertyActionListener. However the bean method never gets called.</p>
  
  <p>A troubling part of this is the page I am working on has buttons elsewhere using nearly identical code and these buttons work just fine.</p>
  
  <p>Clicking on this button refreshes the page, but nothing else. Some relevant information: the button is inside of a ui:repeat, which is inside of another ui:repeat, which is inside of a p:dataGrid. The whole thing is contained inside of an h:form. There are two h:form tags on the page, however they are not nested. This button is inside the second form. The buttons in first form work fine. The backing bean is ViewScoped.</p>
  
  <p>I am working with JSF 2.X and Facelets, as well as using Primefaces. My server is Apache Tomcat v7.0.47</p>
  
  <p>Here is the Action Method:</p>
  
  <pre><code>public final String selectAnswerForRequest() {
      FacesContext fCtx = FacesContext.getCurrentInstance();
      String navString = "";
      try {
          if (chosenAnswer != null &amp;&amp; unansweredRequest != null &amp;&amp; unansweredRequest.getResponse() != null) {
              brain.handleResponse(unansweredRequest.getResponse(), chosenAnswer, unansweredRequest);
              navString = "refresh";
          }
      } catch (BrainException e) {
          LOGGER.error("Error adding answer", e);
          fCtx.addMessage(null, buildErrorMessage("hdrFailed", "txtErrorAddingAnswer"));
      }
      return navString;
  }
  </code></pre>
  
  <p>Everything has getters and setters. I've tried changing the the action attribute to an actionListener and changed my action method to accept an event but it still didn't work. I've tried changing it from p: to h:. I've tried making it a commandLink, and an h:commandButton.</p>
  
  <p>Edit: Here is is the whole .xhtml document in a more cleaned form:</p>
  
  <pre><code>&lt;ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:p="http://primefaces.org/ui"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
  xmlns:encode="http://envisage.com/jsf/encode"
  template="/templates/twocolumn.xhtml"&gt;
  
  &lt;ui:param name="pageTitle" value="#{msgHome['pageTitle']}" /&gt;
  &lt;ui:param name="pageId" value="pg-home" /&gt;
  &lt;ui:param name="pageDesc" value="#{msgHome['pageDesc']}" /&gt;
  
  &lt;ui:define name="columnOne"&gt;
  
      &lt;h2 class="section-title"&gt;
          &lt;span class="label label-warning label-icon"&gt;&lt;i
              class="eis-icon-recent"&gt;&lt;/i&gt;&lt;/span&gt; #{msgHome['answeredTitle']}
      &lt;/h2&gt;
      &lt;div id="answered-questions" data-resize="trending-sidebar"
          data-min-resize="200"&gt;
          &lt;h:form id="firstform" prependId="false"&gt;
              &lt;p:dataGrid paginatorPosition="bottom" var="req"
                  value="#{homeBean.answeredQuestions}" rows="5" columns="1"
                  paginator="true"
                  paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
                  id="renderTarget1"&gt;
                  &lt;p:column&gt;
                      &lt;section&gt;
                          &lt;div&gt;
                              &lt;dl&gt;
                                  &lt;ui:repeat var="answer" value="#{req.response.answers}"&gt;
                                      &lt;div&gt;
                                          &lt;p:commandButton update="@form, :growlForm:growl"
                                              ajax="false" value="#{msgHome['highlyBtn']}"
                                              action="#{homeBean.markAnswerAsHighlyUseful}"&gt;
                                              &lt;f:setPropertyActionListener
                                                  target="#{homeBean.selectedAnswer}" value="#{answer}" /&gt;
                                              &lt;f:setPropertyActionListener
                                                  target="#{homeBean.selectedRequest}" value="#{req}" /&gt;
                                          &lt;/p:commandButton&gt;
                                          &lt;p:commandButton update="@form, :growlForm:growl"
                                              ajax="false" value="#{msgHome['somewhatBtn']}"
                                              action="#{homeBean.markAnswerAsSomewhatUseful}"&gt;
                                              &lt;f:setPropertyActionListener
                                                  target="#{homeBean.selectedAnswer}" value="#{answer}" /&gt;
                                              &lt;f:setPropertyActionListener
                                                  target="#{homeBean.selectedRequest}" value="#{req}" /&gt;
                                          &lt;/p:commandButton&gt;
                                          &lt;p:commandButton update="@form, :growlForm:growl"
                                              ajax="false" value="#{msgHome['notBtn']}"
                                              action="#{homeBean.markAnswerAsNotUseful}"&gt;
                                              &lt;f:setPropertyActionListener
                                                  target="#{homeBean.selectedAnswer}" value="#{answer}" /&gt;
                                              &lt;f:setPropertyActionListener
                                                  target="#{homeBean.selectedRequest}" value="#{req}" /&gt;
                                          &lt;/p:commandButton&gt;
                                      &lt;/div&gt;
                                      &lt;p:separator /&gt;
                                  &lt;/ui:repeat&gt;
                              &lt;/dl&gt;
                          &lt;/div&gt;
                      &lt;/section&gt;
                  &lt;/p:column&gt;
              &lt;/p:dataGrid&gt;
          &lt;/h:form&gt;
      &lt;/div&gt;
  
  
      &lt;h2&gt;
          &lt;span class="label label-danger label-icon"&gt;&lt;i
              class="eis-icon-question"&gt;&lt;/i&gt;&lt;/span&gt; #{msgHome['unansweredTitle']}
      &lt;/h2&gt;
      &lt;div id="unanswered-questions" data-resize="moderators-sidebar"
          data-min-resize="140"&gt;
          &lt;h:form id="secondForm" prependId="false"&gt;
              &lt;p:dataGrid paginatorPosition="bottom" var="unansweredReq"
                  value="#{homeBean.unansweredRequests}" rows="5" columns="1"
                  paginator="true"
                  paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
                  id="renderTarget2"&gt;
                  &lt;p:column&gt;
                      &lt;section&gt;
                          &lt;div&gt;
                              &lt;dl&gt;
                                  &lt;p:separator /&gt;
                                  &lt;ui:repeat var="match"
                                      value="#{unansweredReq.matchingQuestions}"&gt;
                                      &lt;ui:repeat var="answers" value="#{match.answers}"&gt;
                                          &lt;div&gt;
                                              &lt;p:commandButton update="@form, :growlForm:growl"
                                                  ajax="false" value="#{msgHome['acceptAnsBtn']}"
                                                  action="#{homeBean.selectAnswerForRequest}" execute="@this"&gt;
                                                  &lt;f:setPropertyActionListener
                                                      target="#{homeBean.chosenAnswer}" value="#{answers}" /&gt;
                                                  &lt;f:setPropertyActionListener
                                                      target="#{homeBean.unansweredRequest}"
                                                      value="#{unansweredReq}" /&gt;
                                              &lt;/p:commandButton&gt;
                                              &lt;p:commandButton update="@form, :growlForm:growl"
                                                  ajax="false" value="#{msgHome['removeAnsBtn']}"
                                                  action="#{homeBean.removeAnswerFromRequest}"
                                                  execute="@this"&gt;
                                                  &lt;f:setPropertyActionListener
                                                      target="#{homeBean.chosenAnswer}" value="#{answers}" /&gt;
                                                  &lt;f:setPropertyActionListener
                                                      target="#{homeBean.unansweredRequest}"
                                                      value="#{unansweredReq}" /&gt;
                                              &lt;/p:commandButton&gt;
                                          &lt;/div&gt;
                                          &lt;p:separator /&gt;
                                      &lt;/ui:repeat&gt;
                                  &lt;/ui:repeat&gt;
                              &lt;/dl&gt;
                          &lt;/div&gt;
                      &lt;/section&gt;
                  &lt;/p:column&gt;
              &lt;/p:dataGrid&gt;
          &lt;/h:form&gt;
      &lt;/div&gt;
  
      &lt;h:form id="growlForm"&gt;
          &lt;p:growl id="growl" showDetail="true" life="5000"
              severity="info,warn,error" /&gt;
      &lt;/h:form&gt;
  
      &lt;h:messages /&gt;
  
  &lt;/ui:define&gt;
  </code></pre>
  
  <p></p>
  
  <p>Edit 2: The most recent discovery was that after deleting the upper half of the .xhtml document (The whole first h:form), the buttons in the bottom half started working properly. I am currently attempting to use this knowledge to see where I can get.</p>