Used withdsp:select to display an option in a drop-down list.

<dsp:option value-spec label   selected="{true|false}"</dsp:option>



Specifies this option’s value in one of the following ways:

The value specification can include a tag converter, such as date or null. For more information, see Tag Converters in Chapter 2.


This option’s displayed text.


Set to true or false in order to override the value obtained from the target property specified by dsp:select:

Note: You can specify to select multiple options if the parent dsp:select tag sets its multiple attribute to true.

Usage Notes

dsp:option is used in the context of dsp:select to display a drop-down list option. This tag is only valid when enclosed in a dsp:select tag.

Note:dsp:option uses the iclass attribute in place of the cascading style sheet class attribute to avoid using a Java reserved word in Java code.


<dsp:select bean="Student_01.summerHobbies" multiple="true">
  <dsp:option value="hiking">hiking</dsp:option>
  <dsp:option value="biking">biking</dsp:option>
  <dsp:option value="swimming">swimming</dsp:option>

This drop-down list provides a list of hobbies that include hiking, biking, and swimming. The summerHobbies property is a Collection, so it can hold as many options as the user selects. No options use the selected attribute, so none display as selected unless the summerHobbies property is already set to one or more of those values.

loading table of contents...