Selectpublic class Select extends ListUIBean
Render an HTML input tag of type select.
Examples
<s:select label="Pets"
name="petIds"
list="petDao.pets"
listKey="id"
listValue="name"
multiple="true"
size="3"
required="true"
/>
<s:select label="Months"
name="months"
headerKey="-1" headerValue="Select Month"
list="#{'01':'Jan', '02':'Feb', [...]}"
value="selectedMonth"
required="true"
/>
// The month id (01, 02, ...) returned by the getSelectedMonth() call
// against the stack will be auto-selected
Note: For any of the tags that use lists (select probably being the most ubiquitous), which uses the OGNL list
notation (see the "months" example above), it should be noted that the map key created (in the months example,
the '01', '02', etc.) is typed. '1' is a char, '01' is a String, "1" is a String. This is important since if
the value returned by your "value" attribute is NOT the same type as the key in the "list" attribute, they
WILL NOT MATCH, even though their String values may be equivalent. If they don't match, nothing in your list
will be auto-selected.
|
Fields Summary |
---|
public static final String | TEMPLATE | protected String | emptyOption | protected String | headerKey | protected String | headerValue | protected String | multiple | protected String | size |
Methods Summary |
---|
public void | evaluateExtraParams()
super.evaluateExtraParams();
if (emptyOption != null) {
addParameter("emptyOption", findValue(emptyOption, Boolean.class));
}
if (multiple != null) {
addParameter("multiple", findValue(multiple, Boolean.class));
}
if (size != null) {
addParameter("size", findString(size));
}
if ((headerKey != null) && (headerValue != null)) {
addParameter("headerKey", findString(headerKey));
addParameter("headerValue", findString(headerValue));
}
| protected java.lang.String | getDefaultTemplate()
return TEMPLATE;
| public void | setEmptyOption(java.lang.String emptyOption)
this.emptyOption = emptyOption;
| public void | setHeaderKey(java.lang.String headerKey)
this.headerKey = headerKey;
| public void | setHeaderValue(java.lang.String headerValue)
this.headerValue = headerValue;
| public void | setMultiple(java.lang.String multiple)
this.multiple = multiple;
| public void | setSize(java.lang.String size)
this.size = size;
|
|