Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.5
-
None
-
None
Description
Let's take the example of a simple SexType enumeration
{MALE, FEMALE}, that is used in conjunction with the EnumTypeConverter.
so, the action contains a pair of get/set for SexType ., as well as a getter for sexTraitTypes which returns a list of Key Value Pairs<SexType, String>, (the String is the label)
<s:select
list="sexTraitTypes"
label="%
name="sexTrait"
listKey="key"
listValue="value"
emptyOption="true" />
does NOT preselect anything whereas
<s:combobox
list="sexTraitTypes"
label="%{getText('profile.label.sex')}
"
name="sexTrait"
listKey="key"
listValue="value"
emptyOption="true" />
will automatically preselect the value given by getSexTrait();
Ok, so now, if we use :
<s:select
list="sexTraitTypes"
label="%
name="sexTrait"
value="sexTrait"
listKey="key"
listValue="value"
emptyOption="true" />
Then, it's no better. And actually, the only way to achieve auto-preselection is :
<s:select
list="sexTraitTypes"
label="%{getText('profile.label.sex')}
"
name="sexTrait"
value="sexTrait.toString()"
listKey="key"
listValue="value"
emptyOption="true" />
So, I'm not sure if the need for toString() in the value is a bug by itself, but in any case, the fact that s:select is inconsistent with s:combobox would probably benefit of some improvement.....
Regards,
Sami Dalouche
Attachments
Issue Links
- is related to
-
WW-1711 select tag: current option is not selected if actual value to check is no String (aka: nameValue resolves to type other than String)
- Closed