[
https://issues.apache.org/struts/browse/WW-1738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ted Husted resolved WW-1738.
----------------------------
Resolution: Fixed
AFAICT, resolved by WW-1711.
> Inconsistency between s:combobox and s:select behaviour.
> --------------------------------------------------------
>
> Key: WW-1738
> URL: https://issues.apache.org/struts/browse/WW-1738
> Project: Struts 2
> Issue Type: Improvement
> Affects Versions: 2.0.5
> Reporter: Sami Dalouche
> Fix For: 2.0.6
>
>
> 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="%{getText('profile.label.sex')}"
> 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="%{getText('profile.label.sex')}"
> 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
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.