I don't think you can rely on the select tag for a list of dates, as
it (obviously :)) doesn't know how to convert the dates to string.
What I find strange is that looking at the freemarker code it seems to
be like both the value and the caption should be the same
(toString()):
<@s.iterator value="parameters.list">
<#if parameters.listKey??>
<#if stack.findValue(parameters.listKey)??>
<#assign itemKey = stack.findValue(parameters.listKey)/>
<#assign itemKeyStr = stack.findString(parameters.listKey)/>
<#else>
<#assign itemKey = ''/>
<#assign itemKeyStr = ''/>
</#if>
<#else>
<#assign itemKey = stack.findValue('top')/>
<#assign itemKeyStr = stack.findString('top')>
</#if>
<#if parameters.listValue??>
<#if stack.findString(parameters.listValue)??>
<#assign itemValue = stack.findString(parameters.listValue)/>
<#else>
<#assign itemValue = ''/>
</#if>
<#else>
<#assign itemValue = stack.findString('top')/>
</#if>
<option value="${itemKeyStr?html}"<#rt/>
<#if tag.contains(parameters.nameValue, itemKey) == true>
selected="selected"<#rt/>
</#if>
>${itemValue?html}</option><#lt/>
</@s.iterator>
btw I just realized that you can put put a method call on the
"listKey" and "listValue", like
<s:select .... listKey="%{SomeConverter.dateToString(top)}"
listValue="%{SomeConverter.dateToCaptionString(top)}" />
I haven't tried tho.
musachy
On Mon, Jul 13, 2009 at 12:23 PM, dcabasson<[email protected]> wrote:
>
> Hi, I have trouble understanding the way TypeConversion along a s:select tag.
>
> Any advice on the matter would be welcomed.
>
> I have posted the bug under https://issues.apache.org/struts/browse/WW-3184
> attaching a simple Use Case showing what I find to be an unexpected
> behaviour.
>
> Thanks for your help!
> Denis.
> --
> View this message in context:
> http://www.nabble.com/-Struts-2.1--Using-a-s%3Aselect-with-type-conversion-tp24467738p24467738.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]