Class ForEachTag

  • All Implemented Interfaces:
    Tag

    public class ForEachTag
    extends TagSupport
    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
    • Constructor Detail

      • ForEachTag

        public ForEachTag()
    • Method Detail

      • setItems

        public void setItems​(Expression items)
        Sets the expression used to iterate over. This expression could resolve to an Iterator, Collection, Map, Array, Enumeration or comma separated String.
      • setVar

        public void setVar​(String var)
        Sets the variable name to export for the item being iterated over
      • setIndexVar

        public void setIndexVar​(String indexVar)
        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

        public void setVarStatus​(String var)
        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