org.apache.struts.taglib
Class EnumerateTag

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--javax.servlet.jsp.tagext.BodyTagSupport
              |
              +--org.apache.struts.taglib.EnumerateTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public final class EnumerateTag
extends javax.servlet.jsp.tagext.BodyTagSupport

Custom tag that enumerates the elements of a collection, which can be either an attribute or the property of an attribute. The collection can be an Enumeration, a Vector, or an array of objects.

FIXME - Should support Java2 collection classes as well!

Version:
$Revision: 1.10 $ $Date: 2001/05/20 01:19:01 $
Author:
Craig R. McClanahan
See Also:
Serialized Form

Field Summary
private  java.lang.Object collection
          The collection over which we will be iterating.
private  java.util.Enumeration enumeration
          Enumeration of the elements of this collection.
private  java.lang.String id
          The name of the scripting variable to be exposed.
private  java.lang.String length
          The length value or attribute name (<=0 means no limit).
private  int lengthCount
          The number of elements we have already rendered.
private  int lengthValue
          The actual length value (calculated in the start tag).
protected static MessageResources messages
          The message resources for this package.
private  java.lang.String name
          The name of the collection or owning bean.
private  java.lang.String offset
          The starting offset (zero relative).
private  int offsetValue
          The actual offset value (calculated in the start tag).
private  java.lang.String property
          The property name containing the collection.
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
pageContext, parent, values
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
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
EnumerateTag()
           
 
Method Summary
 int doAfterBody()
          Make the next collection element available and loop, or finish the iterations if there are no more elements.
 int doEndTag()
          Clean up after processing this enumeration.
 int doStartTag()
          Construct an enumeration for the specified collection, and begin looping through the body once per element.
 java.lang.Object getCollection()
          Return the collection over which we will be enumerating.
 java.lang.String getId()
          Return the name of the scripting variable.
 java.lang.String getLength()
          Return the length.
 java.lang.String getName()
          Return the name of the collection or owning bean.
 java.lang.String getOffset()
          Return the offset.
 java.lang.String getProperty()
          Return the property name.
 void release()
          Release any acquired resources.
 void setCollection(java.lang.Object collection)
          Set the collection over which we will be enumerating.
 void setId(java.lang.String id)
          Set the name of the scripting variable.
 void setLength(java.lang.String length)
          Set the length.
 void setName(java.lang.String name)
          Set the name of the collection or owning bean.
 void setOffset(java.lang.String offset)
          Set the offset.
 void setProperty(java.lang.String property)
          Set the property name.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getParent, getValue, getValues, removeValue, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Field Detail

collection

private java.lang.Object collection
The collection over which we will be iterating.

enumeration

private java.util.Enumeration enumeration
Enumeration of the elements of this collection.

id

private java.lang.String id
The name of the scripting variable to be exposed.

length

private java.lang.String length
The length value or attribute name (<=0 means no limit).

lengthCount

private int lengthCount
The number of elements we have already rendered.

lengthValue

private int lengthValue
The actual length value (calculated in the start tag).

messages

protected static MessageResources messages
The message resources for this package.

name

private java.lang.String name
The name of the collection or owning bean.

offset

private java.lang.String offset
The starting offset (zero relative).

offsetValue

private int offsetValue
The actual offset value (calculated in the start tag).

property

private java.lang.String property
The property name containing the collection.
Constructor Detail

EnumerateTag

public EnumerateTag()
Method Detail

getCollection

public java.lang.Object getCollection()
Return the collection over which we will be enumerating.

setCollection

public void setCollection(java.lang.Object collection)
Set the collection over which we will be enumerating.
Parameters:
collection - The new collection

getId

public java.lang.String getId()
Return the name of the scripting variable.
Overrides:
getId in class javax.servlet.jsp.tagext.TagSupport

setId

public void setId(java.lang.String id)
Set the name of the scripting variable.
Overrides:
setId in class javax.servlet.jsp.tagext.TagSupport
Parameters:
id - The new name of the scripting variable

getLength

public java.lang.String getLength()
Return the length.

setLength

public void setLength(java.lang.String length)
Set the length.
Parameters:
length - The new length

getName

public java.lang.String getName()
Return the name of the collection or owning bean.

setName

public void setName(java.lang.String name)
Set the name of the collection or owning bean.
Parameters:
name - The new name

getOffset

public java.lang.String getOffset()
Return the offset.

setOffset

public void setOffset(java.lang.String offset)
Set the offset.
Parameters:
offset - The new offset

getProperty

public java.lang.String getProperty()
Return the property name.

setProperty

public void setProperty(java.lang.String property)
Set the property name.
Parameters:
property - The property name

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Construct an enumeration for the specified collection, and begin looping through the body once per element.
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspException
Make the next collection element available and loop, or finish the iterations if there are no more elements.
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Clean up after processing this enumeration.
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

release

public void release()
Release any acquired resources.
Overrides:
release in class javax.servlet.jsp.tagext.BodyTagSupport


Copyright © 2000-2002 - Apache Software Foundation