|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.stripes.tag.StripesTagSupport
net.sourceforge.stripes.tag.HtmlTagSupport
net.sourceforge.stripes.tag.InputOptionsCollectionTag
public class InputOptionsCollectionTag
Writes a set of <option value="foo">bar</option> tags to the page based on the contents of a Collection. Each element in the collection is represented by a single option tag on the page. Uses the label and value attributes on the tag to name the properties of the objects in the Collection that should be used to generate the body of the HTML option tag and the value attribute of the HTML option tag respectively.
E.g. a tag declaration that looks like:
<stripes:options-collection collection="${cats} value="catId" label="name"/>
would cause the container to look for a Collection called "cats" across the various JSP scopes and set it on the tag. The tag would then proceed to iterate through that collection calling getCatId() and getName() on each cat to produce HTML option tags.
All other attributes on the tag (other than collection, value and label) are passed directly through to the InputOptionTag which is used to generate the individual HTML options tags. As a result the InputOptionsCollectionTag will exhibit the same re-population/selection behaviour as the regular options tag.
Since the tag has no use for one it does not allow a body.
| Field Summary |
|---|
| Fields inherited from class net.sourceforge.stripes.tag.StripesTagSupport |
|---|
pageContext, parentTag |
| Fields inherited from interface javax.servlet.jsp.tagext.Tag |
|---|
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
| Constructor Summary | |
|---|---|
InputOptionsCollectionTag()
|
|
| Method Summary | |
|---|---|
int |
doEndTag()
Does nothing. |
int |
doStartTag()
Iterates through the collection and uses an instance of InputOptionTag to generate each individual option with the correct state. |
Collection |
getCollection()
Returns the value set with setCollection(). |
String |
getLabel()
Gets the property name set with setLabel(). |
String |
getValue()
Returns the property name set with setValue(). |
void |
setCollection(Collection collection)
Sets the collection that will be used to generate options. |
void |
setLabel(String label)
Sets the name of the property that will be fetched on each bean in the collection in order to generate the body of each option (i.e. |
void |
setValue(String value)
Sets the name of the property that will be fetched on each bean in the collection in order to generate the value attribute of each option. |
| Methods inherited from class net.sourceforge.stripes.tag.HtmlTagSupport |
|---|
evaluateExpression, get, getAccesskey, getAttributes, getBodyContent, getBodyContentAsString, getCssClass, getDir, getId, getLang, getOnblur, getOnchange, getOnclick, getOndblclick, getOnfocus, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnselect, getStyle, getTabindex, getTitle, release, set, setAccesskey, setBodyContent, setClass, setCssClass, setDir, setId, setLang, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setStyle, setTabindex, setTitle, toString, writeAttributes, writeCloseTag, writeOpenTag, writeSingletonTag |
| Methods inherited from class net.sourceforge.stripes.tag.StripesTagSupport |
|---|
getPageContext, getParent, getParentTag, setPageContext, setParent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface javax.servlet.jsp.tagext.Tag |
|---|
getParent, release, setPageContext, setParent |
| Constructor Detail |
|---|
public InputOptionsCollectionTag()
| Method Detail |
|---|
public void setCollection(Collection collection)
public Collection getCollection()
public void setValue(String value)
value - the name of the attributepublic String getValue()
public void setLabel(String label)
label - the name of the attributepublic String getLabel()
public int doStartTag()
throws JspException
doStartTag in interface TagdoStartTag in class StripesTagSupportJspException - if either the label or value attributes specify properties that are
not present on the beans in the collection, or output cannot be written.
public int doEndTag()
throws JspException
doEndTag in interface TagdoEndTag in class StripesTagSupportJspException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||