title: h:commandButton is not working once I wrap it in a <h:panelGroup rendered>
body: <p>The reason why the topic has "kind of" is because I have an example in JSF 2.2 where I use a commandButton and call a bean function twice (depending on the url). It's basically the same code, which executes only in one example.</p>
  
  <p>Here's the code with the description of the "error" below the code:</p>
  
  <p>User bean</p>
  
  <pre><code>@ManagedBean
  @RequestScoped
  public class User {
  
  private String name;
  private String surname;
  private int age;
  private int id;
  
  public String getName() {
      return name;
  }
  public void setName(String name) {
      this.name = name;
  }
  
  public String getSurname() {
      return surname;
  }
  public void setSurname(String surname) {
      this.surname = surname;
  }
  
  public int getAge() {
      return age;
  }
  public void setAge(int age) {
      this.age = age;
  }
  
  public int getId() {
      return id;
  }
  public void setId(int id) {
      this.id = id;
  }
  
  public User(String name, String surname, int age, int id) {
      super();
      this.name = name;
      this.surname = surname;
      this.age = age;
      this.id = id;
  }
  
  public User(){}
  
  }
  </code></pre>
  
  <p>UsersBean bean:</p>
  
  <pre><code>@ManagedBean
  @SessionScoped
  public class UsersBean {
  
  private List&lt;User&gt; listOfUsers = new ArrayList&lt;User&gt;();
  private String passedParameter;
  
  public UsersBean() {
      listOfUsers.add(new User("Tywin", "Lannister", 60, 1));
      listOfUsers.add(new User("Tyrion", "Lannister", 30, 2));
      listOfUsers.add(new User("Jaime", "Lannister", 31, 3));
      listOfUsers.add(new User("Cercei", "Lannister", 29, 4));
      listOfUsers.add(new User("John", "Snow", 31, 5));
  }
  
  public List&lt;User&gt; getAll() {
  
      System.out.println("getAall is called.");
      return listOfUsers;
  }
  
  public User getDetails() {
      passedParameter = (String) FacesContext.getCurrentInstance()
              .getExternalContext().getRequestParameterMap().get("userID");
      int id = Integer.parseInt(passedParameter);
      User selected = null;
      for (User u : listOfUsers) {
          if (u.getId() == id) {
              selected = u;
          }
      }
      return selected;
  }
  
  public String addUser(User u) {
      System.out.println("addUser is called.");
      if (u.getId() != 0) {
          for (User edit : listOfUsers) {
              if (edit.getId() == u.getId()) {
                  System.out.println("Found it!");
                  edit.setAge(u.getAge());
                  edit.setName(u.getName());
                  edit.setSurname(u.getSurname());
              }
          }
  
      } else {
          u.setId(listOfUsers.size() + 1);
          listOfUsers.add(u);
      }
  
      return "";
  }
  }
  </code></pre>
  
  <p>users.xhtml:</p>
  
  <pre><code>    &lt;f:view&gt;
          &lt;!-- http://stackoverflow.com/questions/8083469/method-must-have-signature-string-method-etc-but-has-signature-void --&gt;
          &lt;h:dataTable value="#{usersBean.all}" var="u"&gt;
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      User ID
                  &lt;/f:facet&gt;
                      #{u.id}
              &lt;/h:column&gt;
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      Name
                  &lt;/f:facet&gt;
                      #{u.name}
              &lt;/h:column&gt; 
  
              &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;
                      Details
                  &lt;/f:facet&gt;
  
                  &lt;h:link outcome="users" value="edit user"&gt;
                      &lt;f:param name="userID" value="#{u.id}"&gt;&lt;/f:param&gt;
                      &lt;f:param name="action" value="edit"&gt;&lt;/f:param&gt;
                  &lt;/h:link&gt;
  
                  &amp;nbsp;
  
                  &lt;h:link outcome="usersDetails" value="get details"&gt;
                      &lt;f:param name="userID" value="#{u.id}"&gt;&lt;/f:param&gt;
                  &lt;/h:link&gt;                   
              &lt;/h:column&gt; 
  
          &lt;/h:dataTable&gt;
  
          &lt;h:panelGroup rendered="#{param['action'] == 'edit'}"&gt;
              &lt;h1&gt;Edit!&lt;/h1&gt;
              &lt;h:form&gt;
                  &lt;ui:param name="editUser" value="#{usersBean.details}"&gt;&lt;/ui:param&gt;
                  &lt;h:outputText value="Name"&gt;&lt;/h:outputText&gt;
                  &lt;h:inputText value="#{editUser.name}"&gt;&lt;/h:inputText&gt; &lt;br /&gt;
  
                  &lt;h:outputText value="Surname"&gt;&lt;/h:outputText&gt;
                  &lt;h:inputText value="#{editUser.surname}"&gt;&lt;/h:inputText&gt; &lt;br /&gt;
  
                  &lt;h:outputText value="Age"&gt;&lt;/h:outputText&gt;
                  &lt;h:inputText value="#{editUser.age}"&gt;&lt;/h:inputText&gt; &lt;br /&gt;
  
                  &lt;h:commandButton action="#{usersBean.addUser(editUser)}" value="Edit" type="submit"&gt;    &lt;/h:commandButton&gt;
              &lt;/h:form&gt;
      &lt;/h:panelGroup&gt;
  
          &lt;h:panelGroup rendered="#{empty param['action']}"&gt;
              &lt;h1&gt;Add!&lt;/h1&gt;
              &lt;h:form&gt;
                  &lt;h:outputText value="Name"&gt;&lt;/h:outputText&gt;
                  &lt;h:inputText value="#{user.name}"&gt;&lt;/h:inputText&gt;
                  &lt;h:outputText value="Surname"&gt;&lt;/h:outputText&gt;
                  &lt;h:inputText value="#{user.surname}"&gt;&lt;/h:inputText&gt;
                  &lt;h:outputText value="Age"&gt;&lt;/h:outputText&gt;
                  &lt;h:inputText value="#{user.age}"&gt;&lt;/h:inputText&gt;
                  &lt;h:commandButton action="#{usersBean.addUser(user)}" value="Add" type="submit"&gt;&lt;/h:commandButton&gt;
              &lt;/h:form&gt;
          &lt;/h:panelGroup&gt;     
  
      &lt;/f:view&gt;
  </code></pre>
  
  <p>OK, so, everything works perfectly. usersBean.addUser adds the user. If I add another inputText for ID and I put in an existing ID, the corresponding function updates the values. So, addUser function works as expected.</p>
  
  <p>The problem is in case of </p>
  
  <pre><code>&lt;h:panelGroup rendered="#{param['action'] == 'edit'}"&gt;
  </code></pre>
  
  <p>as you can see in the xhtml above, the code is basically the same, with the sole exception that I fill in the data of the user that was selected. This works, I get the appropriate data into input fields, but when I change them and click Edit, nothing happens. The function is not called! whereas in case of add, the function is called and it works.
  It appears as if there is no action defined in case of edit, it only reloads the page (submit) without the actual action addUser.</p>
  
  <p>How is this caused and how can I solve it?</p>