Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-12232

[CDK] Support "varStatus" attribute on c:forEach

    Details

    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.2.1.Final
    • Fix Version/s: 4.3.0.M1
    • Component/s: cdk
    • Labels:
    • Environment:

      All

      Description

      Right now, when using <c:forEach> tag on a CDK template.xml, you will have a "for" loop in Java code. There is no way to do simple logic in the template like knowing your current index inside the loop, etc...

      An idea would be to support the varStatus attribute from the original <c:forEach>. This attribute maps to the name of a bean which contains util methods and evolve at each iteration of the loop.

      Here is a sample:

      <c:forEach var="child" items="#{component.getChildren()}" varStatus="status">
          // Inside code
      </c:forEach>
      

      Would generate something like:

      LoopTagStatus status = new LoopTagStatus();
      for(UIComponent child : component.getChildren()) {
          // Inside code
          status.next();
      }
      

      The javadoc of the original LoopTagStatus from JSTL is here. Our LoopTagStatus would have the method and one more : the next() method. This one would increment the current index of the LoopTagStatus in order to be updated for the next iteration.

      We could also add any other usefull methods to this bean.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  lfryc Lukáš Fryč (Inactive)
                  Reporter:
                  paul.dijou Paul Dijou
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: