|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.jsp.tagext.TagSupport | +--org.apache.struts.taglib.html.OptionsTag
Tag for creating multiple <select> options from a collection. The associated values displayed to the user may optionally be specified by a second collection, or will be the same as the values themselves. Each collection may be an array of objects, a Collection, an Enumeration, an Iterator, or a Map. NOTE - This tag requires a Java2 (JDK 1.2 or later) platform.
Field Summary | |
protected java.lang.String |
collection
The name of the collection containing beans that have properties to provide both the values and the labels (identified by the property and labelProperty attributes). |
protected boolean |
filter
Should the label values be filtered for HTML sensitive characters? |
protected java.lang.String |
labelName
The name of the bean containing the labels collection. |
protected java.lang.String |
labelProperty
The bean property containing the labels collection. |
protected static MessageResources |
messages
The message resources for this package. |
protected java.lang.String |
name
The name of the bean containing the values collection. |
protected java.lang.String |
property
The name of the property to use to build the values collection. |
private java.lang.String |
style
The style associated with this tag. |
private java.lang.String |
styleClass
The named style class associated with this tag. |
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 |
Constructor Summary | |
OptionsTag()
|
Method Summary | |
protected void |
addOption(java.lang.StringBuffer sb,
java.lang.String value,
java.lang.String label,
boolean matched)
Add an option element to the specified StringBuffer based on the specified parameters. |
int |
doEndTag()
Process the end of this tag. |
int |
doStartTag()
Process the start of this tag. |
java.lang.String |
getCollection()
|
boolean |
getFilter()
|
protected java.util.Iterator |
getIterator(java.lang.String name,
java.lang.String property)
Return an iterator for the option labels or values, based on our configured properties. |
java.lang.String |
getLabelName()
|
java.lang.String |
getLabelProperty()
|
java.lang.String |
getName()
|
java.lang.String |
getProperty()
|
java.lang.String |
getStyle()
|
java.lang.String |
getStyleClass()
|
void |
release()
Release any acquired resources. |
void |
setCollection(java.lang.String collection)
|
void |
setFilter(boolean filter)
|
void |
setLabelName(java.lang.String labelName)
|
void |
setLabelProperty(java.lang.String labelProperty)
|
void |
setName(java.lang.String name)
|
void |
setProperty(java.lang.String property)
|
void |
setStyle(java.lang.String style)
|
void |
setStyleClass(java.lang.String styleClass)
|
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 |
Field Detail |
protected static MessageResources messages
protected java.lang.String collection
property
and labelProperty
attributes).
protected boolean filter
protected java.lang.String labelName
protected java.lang.String labelProperty
protected java.lang.String name
protected java.lang.String property
private java.lang.String style
private java.lang.String styleClass
Constructor Detail |
public OptionsTag()
Method Detail |
public java.lang.String getCollection()
public void setCollection(java.lang.String collection)
public boolean getFilter()
public void setFilter(boolean filter)
public java.lang.String getLabelName()
public void setLabelName(java.lang.String labelName)
public java.lang.String getLabelProperty()
public void setLabelProperty(java.lang.String labelProperty)
public java.lang.String getName()
public void setName(java.lang.String name)
public java.lang.String getProperty()
public void setProperty(java.lang.String property)
public java.lang.String getStyle()
public void setStyle(java.lang.String style)
public java.lang.String getStyleClass()
public void setStyleClass(java.lang.String styleClass)
public int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
- if a JSP exception has occurredpublic int doEndTag() throws javax.servlet.jsp.JspException
doEndTag
in interface javax.servlet.jsp.tagext.Tag
doEndTag
in class javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
- if a JSP exception has occurredpublic void release()
release
in interface javax.servlet.jsp.tagext.Tag
release
in class javax.servlet.jsp.tagext.TagSupport
protected void addOption(java.lang.StringBuffer sb, java.lang.String value, java.lang.String label, boolean matched)
Note that this tag specifically does not support the
styleId
tag attribute, which causes the HTML
id
attribute to be emitted. This is because the HTML
specification states that all "id" attributes in a document have to be
unique. This tag will likely generate more than one option
element element, but it cannot use the same id
value. It's
conceivable some sort of mechanism to supply an array of id
values could be devised, but that doesn't seem to be worth the trouble.
sb
- StringBuffer accumulating our resultsvalue
- Value to be returned to the server for this optionlabel
- Value to be shown to the user for this optionmatched
- Should this value be marked as selected?protected java.util.Iterator getIterator(java.lang.String name, java.lang.String property) throws javax.servlet.jsp.JspException
name
- Name of the bean attribute (if any)property
- Name of the bean property (if any)
javax.servlet.jsp.JspException
- if an error occurs
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |