Class LoopTagSupport

java.lang.Object
jakarta.servlet.jsp.tagext.TagSupport
jakarta.servlet.jsp.jstl.core.LoopTagSupport
All Implemented Interfaces:
LoopTag, IterationTag, JspTag, Tag, TryCatchFinally, Serializable

public abstract class LoopTagSupport extends TagSupport implements LoopTag, IterationTag, TryCatchFinally

Base support class to facilitate implementation of iteration tags.

Since most iteration tags will behave identically with respect to actual iterative behavior, the Jakarta Standard Tag Library provides this base support class to facilitate implementation. Many iteration tags will extend this and merely implement the hasNext() and next() methods to provide contents for the handler to iterate over.

In particular, this base class provides support for:

  • Iteration control, based on protected prepare(), next(), and hasNext() methods
  • Subsetting (begin, end, step functionality, including validation of subset parameters for sensibility)
  • item retrieval (getCurrent())
  • status retrieval (LoopTagStatus)
  • exposing attributes (set by var and varStatus attributes)

In providing support for these tasks, LoopTagSupport contains certain control variables that act to modify the iteration. Accessors are provided for these control variables when the variables represent information needed or wanted at translation time (e.g., var, varStatus). For other variables, accessors cannot be provided here since subclasses may differ on their implementations of how those accessors are received. For instance, one subclass might accept a String and convert it into an object of a specific type by using an expression evaluator; others might accept objects directly. Still others might not want to expose such information to outside control.

See Also: