org.apache.struts.taglib
Class IterateTag

org.apache.struts.taglib.IterateTag

public final class IterateTag

Custom tag that iterates the elements of a collection, which can be either an attribute or the property of an attribute. The collection can be any of the following: an array of objects, an Iterator, a Collection (which includes Lists, Sets and Vectors), or a Map (which includes Hashtables) whose elements will be iterated over.

NOTE - This tag requires a Java2 (JDK 1.2 or later) platform.

Version:
$Revision: 1.11 $ $Date: 2001/05/20 01:19:03 $
Author:
Craig R. McClanahan

Field Summary
private  java.lang.Object collection
          The collection over which we will be iterating.
private  java.lang.String id
          The name of the scripting variable to be exposed.
private  java.util.Iterator iterator
          Iterator of the elements of this collection.
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.
 
Constructor Summary
IterateTag()
           
 
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 iterator 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 iterating.
 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 iterating.
 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.
 

Field Detail

collection

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

id

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

iterator

private java.util.Iterator iterator
Iterator of the elements of this collection.

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

IterateTag

public IterateTag()
Method Detail

getCollection

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

setCollection

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

getId

public java.lang.String getId()
Return the name of the scripting variable.

setId

public void setId(java.lang.String id)
Set the name of the scripting variable.
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 iterator for the specified collection, and begin looping through the body once per element.
Throws:
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.
Throws:
JspException - if a JSP exception has occurred

doEndTag

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

release

public void release()
Release any acquired resources.


Copyright © 2000-2002 - Apache Software Foundation