[richfaces-issues] [JBoss JIRA] (RF-12232) [CDK] Support "varStatus" attribute on c:forEach
Lukáš Fryč (JIRA)
jira-events at lists.jboss.org
Mon May 14 11:39:19 EDT 2012
[ https://issues.jboss.org/browse/RF-12232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12692709#comment-12692709 ]
Lukáš Fryč commented on RF-12232:
---------------------------------
Good call, Paul, this is very useful for determining if you are on the first/last record of enumeration.
> [CDK] Support "varStatus" attribute on c:forEach
> ------------------------------------------------
>
> Key: RF-12232
> URL: https://issues.jboss.org/browse/RF-12232
> Project: RichFaces
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: cdk
> Affects Versions: 4.2.1.Final
> Environment: All
> Reporter: Paul Dijou
> Labels: cdk, richfaces
>
> 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:
> {code:xml}
> <c:forEach var="child" items="#{component.getChildren()}" varStatus="status">
> // Inside code
> </c:forEach>
> {code}
> Would generate something like:
> {code:java}
> LoopTagStatus status = new LoopTagStatus();
> for(UIComponent child : component.getChildren()) {
> // Inside code
> status.next();
> }
> {code}
> The javadoc of the original {{LoopTagStatus}} from JSTL is [here|http://docs.oracle.com/javaee/5/jstl/1.1/docs/api/javax/servlet/jsp/jstl/core/LoopTagStatus.html]. 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.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the richfaces-issues
mailing list