|
||||||||||
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.OptionsCollectionTag
public class OptionsCollectionTag
Tag for creating multiple <select> options from a collection. The collection may be part of the enclosing form, or may be independent of the form. Each element of the collection must expose a 'label' and a 'value', the property names of which are configurable by attributes of this tag.
The 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 boolean |
filter
Should the label values be filtered for HTML sensitive characters? |
protected String |
label
The name of the bean property containing the label. |
protected static MessageResources |
messages
The message resources for this package. |
protected String |
name
The name of the bean containing the values collection. |
protected String |
property
The name of the property to use to build the values collection. |
protected String |
value
The name of the bean property containing the value. |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
id, pageContext |
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 | |
---|---|
OptionsCollectionTag()
|
Method Summary | |
---|---|
protected void |
addOption(StringBuffer sb,
String label,
String value,
boolean matched)
Add an option element to the specified StringBuffer based on the specified parameters. |
int |
doStartTag()
Process the start of this tag. |
boolean |
getFilter()
|
protected Iterator |
getIterator(Object collection)
Return an iterator for the options collection. |
String |
getLabel()
|
String |
getName()
|
String |
getProperty()
|
String |
getStyle()
|
String |
getStyleClass()
|
String |
getValue()
|
void |
release()
Release any acquired resources. |
void |
setFilter(boolean filter)
|
void |
setLabel(String label)
|
void |
setName(String name)
|
void |
setProperty(String property)
|
void |
setStyle(String style)
|
void |
setStyleClass(String styleClass)
|
void |
setValue(String value)
|
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
doAfterBody, doEndTag, 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 boolean filter
protected String label
protected String name
protected String property
protected String value
Constructor Detail |
---|
public OptionsCollectionTag()
Method Detail |
---|
public boolean getFilter()
public void setFilter(boolean filter)
public String getLabel()
public void setLabel(String label)
public String getName()
public void setName(String name)
public String getProperty()
public void setProperty(String property)
public String getStyle()
public void setStyle(String style)
public String getStyleClass()
public void setStyleClass(String styleClass)
public String getValue()
public void setValue(String value)
public int doStartTag() throws JspException
doStartTag
in interface Tag
doStartTag
in class TagSupport
JspException
- if a JSP exception has occurredpublic void release()
release
in interface Tag
release
in class TagSupport
protected void addOption(StringBuffer sb, String label, String value, 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 Iterator getIterator(Object collection) throws JspException
collection
- Collection to be iterated over
JspException
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |