Defines a selection control—either a drop-down list or selection box..
<dsp:select bean="property-spec
" [name=input-name][
nodefault="{true|false}"]
[
priority="integer
-value
"]
[
multiple="{true|false}"]
[dynamic attributes]
>
dsp:
option
tags
</dsp:select>
Attributes
bean
Specifies the property to update from the user’s selection: its Nucleus path, component name, and property name. The property specification can also include a tag converter, such as date or null. For more information, see Tag Converters.
name
Assigns a name to this drop-down list, which enables access to it during form processing. If no name is provided, the ATG platform automatically supplies one.
The name
attribute provides a name to a drop-down list that is used during form processing. It is not necessary to include a name in dsp:select
tags; the ATG platform automatically supplies one if none is specified.
nodefault
Unless you specify otherwise, the control displays the bean’s current value as the initial selection.. To override this behavior, set the dsp:select
tag’s nodefault
attribute together with the dsp:option
tag’s selected
attribute.
When the bean property in the dsp:select
tag holds a value that matches one or more options provided by the subordinate dsp:option
tags, those values display as default selections. You can block this behavior by setting the nodefault
attribute to true as a runtime expression, indicating that default values are not displayed.
priority
Specifies the priority of this control during form processing relative to other input controls. This attribute can be especially helpful when making changes to an item’s repository ID and the properties it contains. If you first update the supplemental properties and then the repository ID, the new property values can be flushed when the repository ID change occurs.
For more information, see Order of Tag Processing
multiple
If set to true, enables selection of multiple options. The default behavior enables selection of only one option. Set this attribute to true only if the target property is an array,
dynamic attributes
Include additional attributes as needed for the output that your JSP will generate. This tag will pass the attributes into the corresponding output tag. The names of the attributes you include are not validated by the dsp tag library.
Usage Notes
dsp:select
lets you define drop-down lists or select boxes in JSPs much like the HTML tag select
. List options are defined by multiple dsp:option
tags.
This tag must be enclosed in a dsp:form
, which can be provided in the same page or a parent page. See Embedding Pages in Forms.
Note: dsp:select
uses the iclass
attribute in place of the cascading stylesheet class
attribute to avoid using a Java reserved word in Java code.
Embedding custom attributes
A dsp:select
tag can embed one or more custom attributes through the dsp:tagAttribute tag, as follows:
<dsp:select ...> dsp:tagAttribute name="attr-name
" value="value
"/> <dsp:select/>
You can use dsp:tagAttribute tags in order to add attributes to the generated HTML beyond the fixed set of attributes supported by the DSP tag library.
Example
<dsp:select bean="Student_01.Summerhobbies" multiple="true"
nodefault="true" priority="10">
<dsp:option value="hiking">hiking</dsp:option>
<dsp:option value="biking">biking</dsp:option>
<dsp:option value="swimming">swimming</dsp:option>
</dsp:select>
This example creates a select box of summer hobbies from which a user can select options: hiking, biking, or swimming. The user’s selection, which is saved to the summerHobbies
property of the Student_01
component, can include multiple options (hiking and biking, for example) so the summerHobbies
property must be an array. If the summerHobbies
property already holds the values biking and swimming, for example, those values are not selected as defaults in the form because the nodefault
attribute blocks that functionality. By indicating a high priority number, you ensure that this tag set is processed before others in the form.