Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts.taglib.html
Class OptionsTag

    java.lang.Object
      javax.servlet.jsp.tagext.TagSupport
          org.apache.struts.taglib.html.OptionsTag

All Implemented Interfaces:
  Serializable, IterationTag, Tag

Direct Known Subclasses:
  NestedOptionsTag

    public class OptionsTag

extends TagSupport

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.

See Also:
  Serialized Form

Field Summary
`protected 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 String` | `labelName` The name of the bean containing the labels collection.
`protected String` | `labelProperty` The bean property containing the labels collection.
`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.

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
`OptionsTag()`

Method Summary
`protected void` | `addOption(StringBuffer sb, String value, 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.
`String` | `getCollection()`
`boolean` | `getFilter()`
`protected Iterator` | `getIterator(String name, String property)` Return an iterator for the option labels or values, based on our configured properties.
`String` | `getLabelName()`
`String` | `getLabelProperty()`
`String` | `getName()`
`String` | `getProperty()`
`String` | `getStyle()`
`String` | `getStyleClass()`
`void` | `release()` Release any acquired resources.
`void` | `setCollection(String collection)`
`void` | `setFilter(boolean filter)`
`void` | `setLabelName(String labelName)`
`void` | `setLabelProperty(String labelProperty)`
`void` | `setName(String name)`
`void` | `setProperty(String property)`
`void` | `setStyle(String style)`
`void` | `setStyleClass(String styleClass)`

Methods inherited from class javax.servlet.jsp.tagext.TagSupport
`doAfterBody, 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

### messages

    protected static MessageResources messages

  The message resources for this package.

### collection

    protected 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).

### filter

    protected boolean filter

  Should the label values be filtered for HTML sensitive characters?

### labelName

    protected String labelName

  The name of the bean containing the labels collection.

### labelProperty

    protected String labelProperty

  The bean property containing the labels collection.

### name

    protected String name

  The name of the bean containing the values collection.

### property

    protected String property

  The name of the property to use to build the values collection.

Constructor Detail

### OptionsTag

    public OptionsTag()

Method Detail

### getCollection

    public String getCollection()

### setCollection

    public void setCollection(String collection)

### getFilter

    public boolean getFilter()

### setFilter

    public void setFilter(boolean filter)

### getLabelName

    public String getLabelName()

### setLabelName

    public void setLabelName(String labelName)

### getLabelProperty

    public String getLabelProperty()

### setLabelProperty

    public void setLabelProperty(String labelProperty)

### getName

    public String getName()

### setName

    public void setName(String name)

### getProperty

    public String getProperty()

### setProperty

    public void setProperty(String property)

### getStyle

    public String getStyle()

### setStyle

    public void setStyle(String style)

### getStyleClass

    public String getStyleClass()

### setStyleClass

    public void setStyleClass(String styleClass)

### doStartTag

    public int doStartTag()
                   throws JspException

  Process the start of this tag.

  Specified by:
    `doStartTag` in interface `Tag`
  Overrides:
    `doStartTag` in class `TagSupport`
  Throws:
    `JspException` - if a JSP exception has occurred

### doEndTag

    public int doEndTag()
                 throws JspException

  Process the end of this tag.

  Specified by:
    `doEndTag` in interface `Tag`
  Overrides:
    `doEndTag` in class `TagSupport`
  Throws:
    `JspException` - if a JSP exception has occurred

### release

    public void release()

  Release any acquired resources.

  Specified by:
    `release` in interface `Tag`
  Overrides:
    `release` in class `TagSupport`

### addOption

    protected void addOption(StringBuffer sb,
                             String value,
                             String label,
                             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.

  Parameters:
    `sb` - StringBuffer accumulating our results
    `value` - Value to be returned to the server for this option
    `label` - Value to be shown to the user for this option
    `matched` - Should this value be marked as selected?

### getIterator

    protected Iterator getIterator(String name,
                                   String property)
                            throws JspException

  Return an iterator for the option labels or values, based on our configured properties.

  Parameters:
    `name` - Name of the bean attribute (if any)
    `property` - Name of the bean property (if any)
  Throws:
    `JspException` - if an error occurs

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.