org.hdiv.taglib.html
Class OptionsCollectionTagHDIV
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
org.apache.struts.taglib.html.OptionsCollectionTag
org.hdiv.taglib.html.OptionsCollectionTagHDIV
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag
- Direct Known Subclasses:
- ELOptionsCollectionTagHDIV, NestedOptionsCollectionTagHDIV
public class OptionsCollectionTagHDIV
- extends org.apache.struts.taglib.html.OptionsCollectionTag
Renders a set of HTML <option> elements, representing
possible choices for a <select> element. This tag can be used
multiple times within a single <html:select> element, either
in conjunction with or instead of one or more <html:option>
or <html:options> elements.
This tag operates on a collection of beans, where each bean has a label
property and a value property. The actual names of these
properties can be configured using the label and value
attributes of this tag.
This tag differs from the <html:options> tag in that it makes
more consistent use of the name and property
attributes, and allows the collection to be more easily obtained from the
enclosing form bean.
Note that this tag does not support a styleId attribute, as it
would have to apply the value to all the option elements created by
this element, which would mean that more than one id element might
have the same value, which the HTML specification says is illegal.
- Author:
- Gorka Vicente
- See Also:
OptionsCollectionTag,
Serialized Form
| Fields inherited from class org.apache.struts.taglib.html.OptionsCollectionTag |
filter, label, messages, name, property, 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 |
|
Method Summary |
protected void |
addOption(java.lang.StringBuffer sb,
java.lang.String label,
java.lang.String value,
boolean matched)
Add an option element to the specified StringBuffer based on the
specified parameters. |
protected void |
renderAttribute(java.lang.StringBuffer handlers,
java.lang.String name,
java.lang.Object value)
Prepares an attribute if the value is not null, appending it to the the given
StringBuffer. |
| Methods inherited from class org.apache.struts.taglib.html.OptionsCollectionTag |
doStartTag, getFilter, getIterator, getLabel, getName, getProperty, getStyle, getStyleClass, getValue, release, setFilter, setLabel, setName, setProperty, setStyle, setStyleClass, setValue |
| 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 |
OptionsCollectionTagHDIV
public OptionsCollectionTagHDIV()
addOption
protected void addOption(java.lang.StringBuffer sb,
java.lang.String label,
java.lang.String value,
boolean matched)
- Add an option element to the specified StringBuffer based on the
specified parameters.
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.
- Overrides:
addOption in class org.apache.struts.taglib.html.OptionsCollectionTag
- Parameters:
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?- See Also:
org.hdiv.composer.IDataComposer#compose(String, String, boolean)
renderAttribute
protected void renderAttribute(java.lang.StringBuffer handlers,
java.lang.String name,
java.lang.Object value)
- Prepares an attribute if the value is not null, appending it to the the given
StringBuffer.
- Parameters:
handlers - The StringBuffer that output will be appended to.
Copyright © 2008 hdiv.org. All Rights Reserved.