struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JC Oosthuizen <>
Subject Re: Datetimepicker conversion problem
Date Fri, 15 Aug 2008 13:17:15 GMT

Hi All,

I managed to get a workaround and understands the problem a bit better now.

The displayFormat is not only used to format the date on the display side
but is also used to format the data that comes from the action. If I specify
a value, the registered converter will be called but the datepicker will
still try to format according to the displayFormat, which is mostly not an
issue but creates problems when my date is null. This happens because the
null date is converted as an empty string which cannot be parsed according
to the displayFormat.

The workaround is to change the tag to:
<s:datetimepicker cssClass="text medium" name="miniSub.installDate"
		displayFormat="%{getText('date.format')}" value="%{miniSub.installDate ==
null ? '00/00/00' : miniSub.installDate}"/>

This solves my problem but I think the date picker should not give
exceptions when the value is set to a empty string.


JC Oosthuizen

JC Oosthuizen wrote:
> Hi All,
> I am using a datetimepicker on my jsp. The field containing the date is of
> type org.joda.time.DateTime. Struts does not know how to convert DateTime
> to and from Strings so I created my own Converter and it works fine when I
> use a textfield, but gives me a ParseException when using a
> datetimepicker.
> The tag in my jsp looks as follows:
> <s:datetimepicker cssClass="text medium" name="miniSub.installDate"
> label="%{getText('miniSub.installDate')}"
> displayFormat="%{getText('date.format')}"/>
> When the page gets rendered the converter is called and the DateTime is
> converted to a string, but that string is not used by the datetimepicker.
> This causes a ParseException to occur.
> How can I tell the datetimepicker to not try and convert the data on its
> own but to use the registered converter to convert the data.
> Regards,
> JC Oosthuizen

View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message