org.apache.taglibs.standard.tag.common.xml
Class ForEachTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.jstl.core.LoopTagSupport
          extended by org.apache.taglibs.standard.tag.common.xml.ForEachTag
All Implemented Interfaces:
Serializable, LoopTag, IterationTag, JspTag, Tag, TryCatchFinally

public class ForEachTag
extends LoopTagSupport

Support for the XML library's <forEach> tag.

Author:
Shawn Bayern
See Also:
LoopTagSupport, Serialized Form

Field Summary
 
Fields inherited from class javax.servlet.jsp.jstl.core.LoopTagSupport
begin, beginSpecified, deferredExpression, end, endSpecified, itemId, statusId, step, stepSpecified
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
ForEachTag()
           
 
Method Summary
 Node getContext()
           
protected  boolean hasNext()
          Returns information concerning the availability of more items over which to iterate.
protected  Object next()
          Returns the next object over which the tag should iterate.
protected  void prepare()
          Prepares for a single tag invocation.
 void release()
          Releases any resources this LoopTagSupport may have (or inherit).
 void setBegin(int begin)
           
 void setEnd(int end)
           
 void setSelect(String select)
           
 void setStep(int step)
           
 
Methods inherited from class javax.servlet.jsp.jstl.core.LoopTagSupport
doAfterBody, doCatch, doFinally, doStartTag, getCurrent, getDelims, getLoopStatus, setVar, setVarStatus, validateBegin, validateEnd, validateStep
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
doEndTag, getParent, setPageContext, setParent
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
doEndTag, getParent, setPageContext, setParent
 

Constructor Detail

ForEachTag

public ForEachTag()
Method Detail

prepare

protected void prepare()
                throws JspTagException
Description copied from class: LoopTagSupport

Prepares for a single tag invocation. Specifically, allows subclasses to prepare for calls to hasNext() and next(). Subclasses can assume that prepare() will be called once for each invocation of doStartTag() in the superclass.

Specified by:
prepare in class LoopTagSupport
Throws:
JspTagException

hasNext

protected boolean hasNext()
                   throws JspTagException
Description copied from class: LoopTagSupport

Returns information concerning the availability of more items over which to iterate. This method must be provided by concrete subclasses of LoopTagSupport to assist the iterative logic provided by the supporting base class.

See next for more information about the purpose and expectations behind this tag.

Specified by:
hasNext in class LoopTagSupport
Returns:
true if there is at least one more item to iterate over, false otherwise
Throws:
JspTagException
See Also:
LoopTagSupport.next()

next

protected Object next()
               throws JspTagException
Description copied from class: LoopTagSupport

Returns the next object over which the tag should iterate. This method must be provided by concrete subclasses of LoopTagSupport to inform the base logic about what objects it should iterate over.

It is expected that this method will generally be backed by an Iterator, but this will not always be the case. In particular, if retrieving the next object raises the possibility of an exception being thrown, this method allows that exception to propagate back to the JSP container as a JspTagException; a standalone Iterator would not be able to do this. (This explains why LoopTagSupport does not simply call for an Iterator from its subtags.)

Specified by:
next in class LoopTagSupport
Returns:
the java.lang.Object to use in the next round of iteration
Throws:
JspTagException - for other, unexpected exceptions

release

public void release()
Description copied from class: LoopTagSupport
Releases any resources this LoopTagSupport may have (or inherit).

Specified by:
release in interface Tag
Overrides:
release in class LoopTagSupport
See Also:
Tag.release()

setSelect

public void setSelect(String select)

setBegin

public void setBegin(int begin)
              throws JspTagException
Throws:
JspTagException

setEnd

public void setEnd(int end)
            throws JspTagException
Throws:
JspTagException

setStep

public void setStep(int step)
             throws JspTagException
Throws:
JspTagException

getContext

public Node getContext()
                throws JspTagException
Throws:
JspTagException


Copyright © 2007 Mort Bay Consulting. All Rights Reserved.