struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (WW-3184) Type conversion & s:select
Date Fri, 11 Apr 2014 14:39:22 GMT

     [ https://issues.apache.org/jira/browse/WW-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Lukasz Lenart updated WW-3184:
------------------------------

    Fix Version/s:     (was: 2.3.18)
                   2.5

> Type conversion & s:select
> --------------------------
>
>                 Key: WW-3184
>                 URL: https://issues.apache.org/jira/browse/WW-3184
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.1.6
>         Environment: Struts 2.1.6
>            Reporter: Denis Cabasson
>            Assignee: Lukasz Lenart
>             Fix For: 2.5
>
>         Attachments: test-struts2-dates.zip
>
>
> Hi,
> So I'm trying to understand a little bit better the way type conversion is supposed to
work in struts 2/Xwork 2 and I really don't get it. The part I am missing is when is that
conversion applied, and on what basis?
> My use case is an action that must present a select box containing dates. So hoping to
have struts 2 do all the heavy lifting, I create my action with a field
> private List<Date> theDates;
> fills it with the right date and render it on the JSP :
> <s:select list="theDates" name="theDate" />
> I have a field on my action to receive this date parameter :
> private Date theDate;
> The problem is that the generated HTML content is :
> <select name="theDate" id="index_theDate">
>     <option value="Mon Jul 13 15:01:21 EDT 2009">7/13/09</option>
>     <option value="Sun Jul 12 15:01:21 EDT 2009">7/12/09</option>
> </select>
> What I don't get is that the body of the option has been correctly converted, while the
value is not at all converted (that looks like a simple toString to me). So of course, the
conversion from the toString version of the date to a date object is failing.
> Now I don't get what I did wrong there, and how this is supposed to work. Definitely
this looks wrong to me, cause the value is the most important thing in the option. But I couldn't
find a way of getting that converted.
> Any advise?
> Thanks for any help.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message