Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Implemented
-
2.1.6
-
None
-
None
-
Struts 2.1.6
Description
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.
Attachments
Attachments
Issue Links
- is duplicated by
-
WW-3650 Double Value Conversion with requestLocale=de
- Closed