javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-2157

UIInput in UIRepeat doesn't redisplay model value when a FacesMessage has been enqueued

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.1.1, 2.1.17
    • Fix Version/s: 2.2.3
    • Component/s: None
    • Labels:
      None
    • Environment:

      Mojarra 2.1.2, Tomcat 7.0.19 / Glassfish 3.1, Win7 x64, Eclipse Helios SR2

      Description

      Consider this view

      <h:form>    
          <ui:repeat value="#{bean.items}" var="item">
              <h:inputText value="#{item}" /><br/>
          </ui:repeat>
      
          <h:commandButton value="Update with message" action="#{bean.update(true)}" />
          <h:commandButton value="Update without message" action="#{bean.update(false)}" />
          <h:messages />
      </h:form>
      

      and this bean

      @ManagedBean
      @ViewScoped
      public class Bean implements Serializable {
      
          private List<Integer> items = Arrays.asList(1, 2, 3);
      
          public void update(boolean withMessage) {
              for (int i = 0; i < items.size(); i++) {
                  items.set(i, items.get(i) + 1);
              }
              
              if (withMessage) {
                  FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Updated!"));
              }
          }
          
          public List<Integer> getItems() {
              return items;
          }
      
      }
      

      When you click either of those buttons, you'd expect that the input values are in all cases redisplayed with model values as set during invoke action. However, when a `FacesMessage` has been enqueued, the submitted values are redisplayed instead even though the input components are marked valid.

      When I replace `<ui:repeat>` by a `<h:dataTable>`, `<t:dataList>`, etc (which all extends `UIData`), then it works as expected.

        Issue Links

          Activity

          Hide
          Manfred Riem added a comment -

          Can you verify if this is still a problem on the latest 2.1 release?

          Show
          Manfred Riem added a comment - Can you verify if this is still a problem on the latest 2.1 release?
          Hide
          balusc added a comment -

          Yes, still reproduced it with 2.1.17.

          Show
          balusc added a comment - Yes, still reproduced it with 2.1.17.
          Hide
          Manfred Riem added a comment -

          I tested this with 2.2.3 and I cannot reproduce it. Closing as "Cannot Reproduce".

          Show
          Manfred Riem added a comment - I tested this with 2.2.3 and I cannot reproduce it. Closing as "Cannot Reproduce".
          Hide
          balusc added a comment -

          Indeed, the problem disappeared since Mojarra 2.1.25. So, one of those fixes listed in https://java.net/jira/secure/ReleaseNote.jspa?projectId=10204&version=16561 has implicitly fixed this problem.

          Show
          balusc added a comment - Indeed, the problem disappeared since Mojarra 2.1.25. So, one of those fixes listed in https://java.net/jira/secure/ReleaseNote.jspa?projectId=10204&version=16561 has implicitly fixed this problem.

            People

            • Assignee:
              Manfred Riem
              Reporter:
              balusc
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: