Class ForEachTag
java.lang.Object
org.apache.commons.jelly.TagSupport
org.apache.commons.jelly.tags.core.ForEachTag
- All Implemented Interfaces:
Tag
Iterates over a collection, iterator or an array of objects.
Uses the same syntax as the JSTL
forEach tag does.- Version:
- $Revision: 155420 $
- Author:
- James Strachan
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classHolds the status of the loop. -
Field Summary
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, parent -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidEvaluates this tag after all the tags properties have been initialized.voidsetBegin(int begin) Sets the starting index valuevoidsetEnd(int end) Sets the ending index valuevoidsetIndexVar(String indexVar) Sets the variable name to export the current index counter tovoidsetItems(Expression items) Sets the expression used to iterate over.voidsetStep(int step) Sets the index increment stepvoidSets the variable name to export for the item being iterated overvoidsetVarStatus(String var) Sets the variable name to export the current status to.Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
-
Constructor Details
-
ForEachTag
public ForEachTag()
-
-
Method Details
-
doTag
Description copied from interface:TagEvaluates this tag after all the tags properties have been initialized. -
setItems
Sets the expression used to iterate over. This expression could resolve to an Iterator, Collection, Map, Array, Enumeration or comma separated String. -
setVar
Sets the variable name to export for the item being iterated over -
setIndexVar
Sets the variable name to export the current index counter to -
setBegin
public void setBegin(int begin) Sets the starting index value -
setEnd
public void setEnd(int end) Sets the ending index value -
setStep
public void setStep(int step) Sets the index increment step -
setVarStatus
Sets the variable name to export the current status to. The status is an implementation of the JSTL LoopTagStatus interface that provides the following bean properties:- current - the current value of the loop items being iterated
- index - the current index of the items being iterated
- first - true if this is the first iteration, false otherwise
- last - true if this is the last iteration, false otherwise
- begin - the starting index of the loop
- step - the stepping value of the loop
- end - the end index of the loop
-