Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4019

Updating a bound value not possible if input component is within c:forEach

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.2.8
    • 2.2.9
    • None
    • None

    Description

      Updating a value is not possible if the respective input component is within a c:forEach tag.

      The server shows a javax.el.PropertyNotFoundException.

      Example:

      View
      <h:form>
      	<c:forEach items="#{controller.containers}" var="container" varStatus="status">
      		<div>
      			<h:selectBooleanCheckbox id="checked_#{status.index}" value="#{container.checked}" />
      							
      			<h:panelGroup id="infotext_#{status.index}">
      				container.checked = #{container.checked}
      			</h:panelGroup>
      		</div>
      	</c:forEach>
      	<h:commandButton value="Apply" />
      </h:form>
      
      Controller.java
      public class Controller {
      	public static final class Container implements Serializable {
      		private boolean checked = false;
      		
      		public final boolean isChecked() { return checked; }
      		public final void setChecked(boolean checked) { this.checked = checked; }
      	}
      	
      	private final List<Container> containers = Arrays.asList(new Container());
      	
      	public List<BooleanValueContainer> getContainers() { return containers; }
      }
      

      A complete example can be found here: https://github.com/jgrimmwsb/faces-repeater-test.

      Steps to reproduce the error:

      1. Ensure the selected myfaces.version in the pom.xml is 2.2.8.
      2. Start the application and open the respective website.
      3. Select c:forEach (non-ajax).
      4. Activate the checkbox.
      5. Click Apply.

      With MyFaces 2.2.7 the error did not occur.

      The project contains further examples:

      • An c:forEach example including an ajaxified version (working with MyFaces 2.2.7)
      • An ui:repeat (ajaxified) example (working with MyFaces 2.2.8)

      Attachments

        Issue Links

          Activity

            People

              lu4242 Leonardo Uribe
              jgrimmwsb Johannes Grimm
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: