Apache Struts API Documentation: Class OptionsTag

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | 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:
  javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class OptionsTag
extends javax.servlet.jsp.tagext.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.

Author:
  Florent Carpentier, Craig McClanahan
See Also:
  Serialized Form

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

Fields inherited from class javax.servlet.jsp.tagext.TagSupport
`id, pageContext, parent, values`

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(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()`
`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()`
`void` | `release()` Release any acquired resources.
`void` | `setCollection(java.lang.String collection)`
`void` | `setLabelName(java.lang.String labelName)`
`void` | `setLabelProperty(java.lang.String labelProperty)`
`void` | `setName(java.lang.String name)`
`void` | `setProperty(java.lang.String property)`

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, registerNatives, toString, wait, wait, wait`

Field Detail

### messages

    protected static MessageResources messages

  The message resources for this package.

### collection

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

### labelName

    protected java.lang.String labelName

  The name of the bean containing the labels collection.

### labelProperty

    protected java.lang.String labelProperty

  The bean property containing the labels collection.

### name

    protected java.lang.String name

  The name of the bean containing the values collection.

### property

    protected java.lang.String property

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

Constructor Detail

### OptionsTag

    public OptionsTag()

Method Detail

### getCollection

    public java.lang.String getCollection()

### setCollection

    public void setCollection(java.lang.String collection)

### getLabelName

    public java.lang.String getLabelName()

### setLabelName

    public void setLabelName(java.lang.String labelName)

### getLabelProperty

    public java.lang.String getLabelProperty()

### setLabelProperty

    public void setLabelProperty(java.lang.String labelProperty)

### getName

    public java.lang.String getName()

### setName

    public void setName(java.lang.String name)

### getProperty

    public java.lang.String getProperty()

### setProperty

    public void setProperty(java.lang.String property)

### doStartTag

    public int doStartTag()
                   throws javax.servlet.jsp.JspException

  Process the start of this tag.
  Overrides:
    `doStartTag` in class `javax.servlet.jsp.tagext.TagSupport`
  Throws:
    `javax.servlet.jsp.JspException` - if a JSP exception has occurred

### doEndTag

    public int doEndTag()
                 throws javax.servlet.jsp.JspException

  Process the end of this tag.
  Overrides:
    `doEndTag` in class `javax.servlet.jsp.tagext.TagSupport`
  Throws:
    `javax.servlet.jsp.JspException` - if a JSP exception has occurred

### release

    public void release()

  Release any acquired resources.
  Overrides:
    `release` in class `javax.servlet.jsp.tagext.TagSupport`

### addOption

    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.
  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 java.util.Iterator getIterator(java.lang.String name,
                                             java.lang.String property)
                                      throws javax.servlet.jsp.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:
    `javax.servlet.jsp.JspException` - if an error occurs

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

Copyright © 2000-2001 - Apache Software Foundation