|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
com.ora.jsp.tags.xmp.SimpleLoopTag
This class is a custom action for looping through the elements of a multi-valued bean or bean property. The bean or bean property must be an array, a Vector, a Dictionary or an Enumeration. The action body is evaluated once for each element.
Note! This action is just intended as an example. I recommend that you use the JSTL <c:forEach> action instead.
Field Summary | |
private java.lang.String |
className
|
private java.util.Enumeration |
enum
|
private java.lang.String |
loopId
|
private java.lang.String |
name
|
private java.lang.String |
property
|
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_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 | |
SimpleLoopTag()
|
Method Summary | |
int |
doAfterBody()
Makes the next element available to the body in a variable with the name specified by the loopId attribute, or returns SKIP_BODY if all elements have been processed. |
int |
doEndTag()
Writes the accumulated body contents to the JspWriter. |
int |
doStartTag()
Creates an Enumeration of all loop values, either using the object specified by the name attribute directly, or using the specified property. |
private java.util.Enumeration |
getEnumeration(java.lang.Object obj)
Returns an Enumeration of the values in the specified multi-value object, which can be an Enumeration, Vector, Dictionary or array of Objects (not primitive types). |
private java.lang.Object |
getProperty(java.lang.Object obj,
java.lang.String property)
Returns an Object representing an Enumeration, a Vector, a Dictionary or an array of objects (no primitive types), using the specified property getter method on the specified object. |
void |
release()
Releases all instance variables. |
void |
setClassName(java.lang.String className)
Sets the class attribute, i.e. |
void |
setLoopId(java.lang.String loopId)
Sets the loopId attribute, i.e. |
void |
setName(java.lang.String name)
Sets the name attribute, i.e. |
void |
setProperty(java.lang.String property)
Sets the property attribute, i.e. |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
doInitBody, getBodyContent, getPreviousOut, 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 |
Field Detail |
private java.lang.String name
private java.lang.String property
private java.lang.String loopId
private java.lang.String className
private java.util.Enumeration enum
Constructor Detail |
public SimpleLoopTag()
Method Detail |
public void setName(java.lang.String name)
name
- the bean variable namepublic void setProperty(java.lang.String property)
property
- the property namepublic void setLoopId(java.lang.String loopId)
public void setClassName(java.lang.String className)
public int doStartTag() throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException
public int doAfterBody() throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException
public int doEndTag() throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException
public void release()
private java.lang.Object getProperty(java.lang.Object obj, java.lang.String property) throws javax.servlet.jsp.JspException
obj
- the Object with the multi-value propertyproperty
- the property name
javax.servlet.jsp.JspException
private java.util.Enumeration getEnumeration(java.lang.Object obj) throws javax.servlet.jsp.JspException
obj
- the multi-value Object
javax.servlet.jsp.JspException
- if invalid type
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |