Hi Roberto,
This is precisely what a custom type-converter is for:
http://struts.apache.org/2.x/docs/type-conversion.html
It accepts a string and converts to an object, and vice versa. It's
invoked by the conversion interceptor.
However, I thought the default Date converter is already setup to
convert ISO-8601 strings to java.util.Date and vice versa. You might
get a nice surprise if you add a Date property to your model with the
startDate name. (The docs mention a locale-dependent date rather than
ISO-8601 so I may be mistaken though).
Roberto Nunnari wrote:
Hi.
I have a form that posts to a ModelDriven Action.
In that form I'm trying to use raw dojo 1.0 DateTextBox, but I have
trouble with the formatting of the date.. According to the
dojo docs, when communicating to/from the server, it uses
ISO-8601.
As java.util.Date doesn't know how to parse ISO-8601
dates, I suppose I'll use a method on the action to parse,
but I'm interested to know how others have solved this
issue. Maybe with an interceptor?
as for formatting the date to initialize the dojo input, here
is the code I put in my jsp:
<input type="text" name="startDate" dojoType="dijit.form.DateTextBox"
required="true" value="<s:date name="startDate" format="yyyy-MM-dd"
/>" size="40"/></td>
Best regards.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]