org.chwf.taglib.jutil
Class ForEachTag

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--javax.servlet.jsp.tagext.BodyTagSupport
              |
              +--org.chwf.taglib.base.LifeCycleBodyTagSupport
                    |
                    +--org.chwf.taglib.jutil.ForEachTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, Parameterized, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class ForEachTag
extends LifeCycleBodyTagSupport

Tag handler for the <forEach> tag.

Author:
Paul Strack
See Also:
Serialized Form

Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
ForEachTag()
           
 
Method Summary
 void cleanup()
          Clean up data for tag handler reuse and pooling.
 int doAfterBody()
          Continues iteration for all values in the collection.
 int doStart()
          Skips body if the collection is empty.
 java.lang.String getCollection()
          The collection name.
 java.lang.String getEl()
          The JSTL Expression Language statement.
 java.lang.String getVar()
          The var name holding each object for iteration.
 void setCollection(java.lang.String collection)
          The collection name.
 void setEl(java.lang.String el)
          The JSTL Expression Language statement.
 void setVar(java.lang.String var)
          The var name holding each object for iteration.
 
Methods inherited from class org.chwf.taglib.base.LifeCycleBodyTagSupport
addAttribute, addParameter, doEnd, doEndTag, doStartTag, getAttribute, getAttributeNames, getParameter, getParameterNames, init, printAttributes
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
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
getParent, setPageContext, setParent
 

Constructor Detail

ForEachTag

public ForEachTag()
Method Detail

cleanup

public void cleanup()
Clean up data for tag handler reuse and pooling. Should be overridden in tag handler. Subclasses should always invoke their superclass's cleanup method: super.cleanup()
Overrides:
cleanup in class LifeCycleBodyTagSupport

setVar

public void setVar(java.lang.String var)
The var name holding each object for iteration.
Parameters:
var - The variable name.

getVar

public java.lang.String getVar()
The var name holding each object for iteration.
Returns:
The variable name.

setCollection

public void setCollection(java.lang.String collection)
The collection name.
Parameters:
collection - The collection name.

getCollection

public java.lang.String getCollection()
The collection name.
Returns:
The collection name.

setEl

public void setEl(java.lang.String el)
The JSTL Expression Language statement.
Parameters:
el - The JSTL Expression Language statement.

getEl

public java.lang.String getEl()
The JSTL Expression Language statement.
Returns:
The JSTL Expression Language statement.

doStart

public int doStart()
            throws javax.servlet.jsp.JspException
Skips body if the collection is empty.
Overrides:
doStart in class LifeCycleBodyTagSupport
Returns:
SKIP_BODY if the collection is empty.
Throws:
javax.servlet.jsp.JspException - If the iterator cannot be initialized.

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspException
Continues iteration for all values in the collection.
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
EVAL_BODY_TAG if there are more elements in the colleciton.
Throws:
javax.servlet.jsp.JspException - for IO exceptions.


Copyright © 2002-2004, Paul Strack. All Rights Reserved.