title: Debug update moderl phase, setter not being called
body: <p>This is a problem of build vs render time I guess. 
  I've a comment section which is a tree of comments. Everything works fine... except for <strong>some</strong> comments the bean setters is not called. </p>
  
  <p>So my understanding is that :</p>
  
  <ul>
  <li><p>when using ui:repeat the composite component is included once at build time, then for each item is rendered with its appropriate value. Why it doesn't work ? no clue.</p></li>
  <li><p>when c:forEach is used, the composite component is integrated multiple times then at render time the item is lost when the commandButton action is to be populated by it.</p></li>
  </ul>
  
  <p>Here is full working example to reproduce the bug:</p>
  
  <p><strong>WorkingTest Bean</strong>:</p>
  
  <pre><code>import java.io.Serializable;
  import javax.faces.view.ViewScoped;
  import javax.inject.Named;
  
  @Named
  @ViewScoped
  public class WorkingTest implements Serializable{
      private static final long serialVersionUID = 1L;
  
      private Post topNode;
      private String replyContent;
      private int counter;
  
      public WorkingTest(){
          topNode = new Post();
          Post p1 = new Post(1, "reply here works");
          p1.getReplies().add(new Post(3, "Reply to this comment &lt;b style=\"color:red\"&gt;doesn't works&lt;/b&gt;, the  content of the comment is null"));
          Post p2 = new Post(1, "reply here works");
          topNode.getReplies().add(p1);
          topNode.getReplies().add(p2);
          counter = 6;
  
      }
  
      public void addReply(Post post){
          post.getReplies().add(new Post(counter, replyContent));
          replyContent = "";
          counter++;
      }
  
      public Post getTopNode() {
          return topNode;
      }
  
      public void setTopNode(Post topNode) {
          this.topNode = topNode;
      }
  
      public String getReplyContent() {
          return replyContent;
      }
  
      public void setReplyContent(String replyContent) {
          System.out.println("settting reply content");
          this.replyContent = replyContent;
      }
  
  }
  </code></pre>
  
  <p><strong>Post class</strong>:</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  
  public class Post {
  
      private long idpost;
      private String content;
      private List&lt;Post&gt; replies = new ArrayList&lt;Post&gt;();
  
      public Post(){}
  
      public Post(long id, String content){ 
          this.content = content; 
          this.idpost = id;
      }
  
      public String getContent() {
          return content;
      }
      public void setContent(String content) {
          this.content = content;
      }
      public List&lt;Post&gt; getReplies() {
          return replies;
      }
      public void setReplies(List&lt;Post&gt; replies) {
          this.replies = replies;
      }
  
      public long getIdpost() {
          return idpost;
      }
  
      public void setIdpost(long id) {
          this.idpost = id;
      }
  }
  </code></pre>
  
  <p><strong>Test.xhtml</strong>:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core"&gt;
  
      &lt;h:head&gt;
          &lt;title&gt;
              &lt;ui:insert&gt;Test&lt;/ui:insert&gt;
          &lt;/title&gt;
  
      &lt;/h:head&gt;
  
      &lt;h:body id="whole"&gt;
  
      Refresh your page between tries, you will see that for some comments the 
  
  value of the comment doesn't appear.
      Because of a bug in mojarra the viewstate is lost after ajax request, that is why u gotta refresh.
      see http://balusc.omnifaces.org/2011/09/communication-in-jsf-20.html#AutomaticallyFixMissingJSFViewStateAfterAjaxRendering if you want more info
      &lt;h:panelGroup  id="replies"&gt;
          &lt;div class="replies"&gt;
              &lt;ui:include src="pv.xhtml" &gt;
                  &lt;ui:param name="node" value="#{workingTest.topNode.replies}"/&gt;
                  &lt;ui:param name="count" value="8"/&gt;
                  &lt;ui:param name="backgroundVar" value="0"/&gt;
                  &lt;ui:param name="isFirst" value="true"/&gt;     
              &lt;/ui:include&gt; 
          &lt;/div&gt;
      &lt;/h:panelGroup&gt;
  
      &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>pv.xhtml</strong>:</p>
  
  <pre><code>&lt;ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:my="http://xmlns.jcp.org/jsf/composite/cc"&gt;
  
  
      &lt;ui:repeat value="#{node}" var="forumPost"&gt;
  
          &lt;div style="padding: 0.4rem; border: 1px solid grey; margin-bottom: #{isFirst ? '1rem' : '0' }"&gt;
              &lt;h:panelGroup id="c"&gt;
  
                  &lt;!-- comment content --&gt;
                  &lt;div class="replyContent"&gt;
                      &lt;h:outputText value="#{forumPost.content}" escape="false"/&gt;
                  &lt;/div&gt;
  
                  &lt;!-- reply block   --&gt;
                  &lt;div class="replyAuthor" id="r-#{forumPost.idpost}"&gt;
                      &lt;my:commentForm value="#{workingTest.replyContent}" actionMethod="#{workingTest.addReply(forumPost)}"/&gt;
                  &lt;/div&gt;
                  &lt;!-- reply block end --&gt;
              &lt;/h:panelGroup&gt;
  
  
              &lt;!--  Replies  --&gt;
              &lt;c:if test="#{count gt 0}"&gt;
                  &lt;ui:include src="pv.xhtml"&gt;
                      &lt;ui:param name="node" value="#{forumPost.replies}"/&gt;
                      &lt;ui:param name="count" value="#{count-1}"/&gt;
                      &lt;ui:param name="backgroundVar" value="#{backgroundVar+1}" /&gt;
                      &lt;ui:param name="isFirst" value="false" /&gt;
                  &lt;/ui:include&gt;
              &lt;/c:if&gt;
          &lt;/div&gt;
  
      &lt;/ui:repeat&gt;
  
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p><strong>commentForm.xhtml</strong> ( composite component )</p>
  
  <pre><code>&lt;ui:composition
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:cc="http://xmlns.jcp.org/jsf/composite"
      xmlns:my="http://xmlns.jcp.org/jsf/composite/cc"&gt;
  
      &lt;cc:interface&gt;
          &lt;cc:attribute name="value" type="java.lang.String" required="true"  /&gt;
          &lt;cc:attribute name="actionMethod" method-signature="void action()"/&gt;
      &lt;/cc:interface&gt;
  
      &lt;cc:implementation&gt;
  
          &lt;h:form&gt;
              &lt;h:inputTextarea value="#{cc.attrs.value}"/&gt;
              &lt;div class="replyBtn"&gt;
                  &lt;h:commandButton value="Reply" action="#{cc.attrs.actionMethod}"&gt;
                      &lt;f:ajax execute="@form" render="replies"/&gt;
                  &lt;/h:commandButton&gt;
              &lt;/div&gt;
          &lt;/h:form&gt;
      &lt;/cc:implementation&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  
  <hr>
  
  <p>For the comments that works and for those that don't the http form data is the same. However for the JSF lifecycle the validators are not called for those that don't work and update phase doesn't call setters :</p>
  
  <p><strong>Working</strong> :</p>
  
  <pre><code>20:34:35,120 INFO  [stdout] (default task-41) START PHASE RESTORE_VIEW 1
  
  20:34:35,228 INFO  [stdout] (default task-41) END PHASE RESTORE_VIEW 1
  
  20:34:35,229 INFO  [stdout] (default task-41) START PHASE APPLY_REQUEST_VALUES 2
  
  20:34:35,229 INFO  [stdout] (default task-41) before msg The form component needs to have a UIForm in its ancestry.
  
  20:34:35,240 INFO  [stdout] (default task-41) END PHASE APPLY_REQUEST_VALUES 2
  
  20:34:35,240 INFO  [stdout] (default task-41) START PHASE PROCESS_VALIDATIONS 3
  
  20:34:35,240 INFO  [stdout] (default task-41) before msg The form component needs to have a UIForm in its ancestry. 
  
  20:34:35,245 INFO  [stdout] (default task-41) DummyConverter getAsObject
  
  20:34:35,245 INFO  [stdout] (default task-41) FieldsNotTooShort: validate
  
  20:34:35,252 INFO  [stdout] (default task-41) END PHASE PROCESS_VALIDATIONS 3
  
  20:34:35,252 INFO  [stdout] (default task-41) START PHASE UPDATE_MODEL_VALUES 4
  
  20:34:35,253 INFO  [stdout] (default task-41) before msg The form component needs to have a UIForm in its ancestry.
  
  20:34:35,257 INFO  [stdout] (default task-41) setting 5555555555555555555555
  
  20:34:35,261 INFO  [stdout] (default task-41) END PHASE UPDATE_MODEL_VALUES 4
  </code></pre>
  
  <hr>
  
  <p><strong>Not working</strong> :</p>
  
  <pre><code>20:39:12,312 INFO  [stdout] (default task-30) START PHASE RESTORE_VIEW 1
  
  20:39:12,432 INFO  [stdout] (default task-30) END PHASE RESTORE_VIEW 1
  
  20:39:12,432 INFO  [stdout] (default task-30) START PHASE APPLY_REQUEST_VALUES 2
  
  20:39:12,432 INFO  [stdout] (default task-30) before msg The form component needs to have a UIForm in its ancestry.
  
  20:39:12,436 INFO  [stdout] (default task-30) END PHASE APPLY_REQUEST_VALUES 2
  
  20:39:12,436 INFO  [stdout] (default task-30) START PHASE PROCESS_VALIDATIONS 3
  
  20:39:12,437 INFO  [stdout] (default task-30) before msg The form component needs to have a UIForm in its ancestry.
  
  20:39:12,440 INFO  [stdout] (default task-30) END PHASE PROCESS_VALIDATIONS 3
  
  20:39:12,441 INFO  [stdout] (default task-30) START PHASE UPDATE_MODEL_VALUES 4
  
  20:39:12,441 INFO  [stdout] (default task-30) before msg The form component needs to have a UIForm in its ancestry.
  
  20:39:12,444 INFO  [stdout] (default task-30) END PHASE UPDATE_MODEL_VALUES 4
  </code></pre>
  
  <hr>
  
  <p>lifecyclelistener:</p>
  
  <pre><code>public class LifeCycleListener implements PhaseListener {
  
      public PhaseId getPhaseId() {
          return PhaseId.ANY_PHASE;
      }
  
      public void beforePhase(PhaseEvent event) {
          System.out.println("START PHASE " + event.getPhaseId());
          List&lt;FacesMessage&gt; msgs = event.getFacesContext().getMessageList();
          for (FacesMessage msg : msgs) {
              System.out.println("before msg " + msg.getSummary() + " :: " + msg.getDetail());
          }
      }
  
      public void afterPhase(PhaseEvent event) {
          System.out.println("END PHASE " + event.getPhaseId());
      }
  
  }
  </code></pre>