struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Musachy Barroso" <musa...@gmail.com>
Subject Re: [s2] datetimepicker - how to preserve original value
Date Tue, 15 May 2007 18:56:22 GMT
This problem is related to this:

https://issues.apache.org/struts/browse/WW-1923

from 2.1 the "value", "startDate" and "endDate" will be evaluated as object,
so we can support Calendar and any object whose toString() returns a
parseable date. In short, use

<s:date value="%{'2007-01-01'}" ../>

instead of

<s:date value="2007-01-01" ../>

so you won't have to make changes for 2.1. To fix your problem now, just
using value="%{foo}" should do, if foo is either a Date object(recommended),
or a string that can be parsed by SimpleFormat.SHORT, SimpleFormat.LONG,
SimpleFormat.FULL, or the format entered in the "displayFormat" attribute

musachy

On 5/15/07, Jon Wilmoth <jonwilmoth@yahoo.com> wrote:
>
> I'm using 2.0.7 and am getting errors when the user inputs an invalid date
> format.  In addition to the stacktrace below, the field's value displayed to
> the user becomes "NaN/NaN/0NaN".  Is this an oversite in the new tag that
> doesn't check to see if a field error exist before attempting to apply
> formatting?
>
> May-15-2007 11:43:04:377 AM, PDT [ERROR] (
> org.apache.struts2.components.DateTimePicker) - Could not parse date
> java.text.ParseException: Unparseable date: "foo"
>         at java.text.DateFormat.parse(DateFormat.java:337)
>         at org.apache.struts2.components.DateTimePicker.format(
> DateTimePicker.java:309)
>         at org.apache.struts2.components.DateTimePicker.evaluateParams(
> DateTimePicker.java:209)
>         at org.apache.struts2.components.UIBean.end(UIBean.java:481)
>         at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(
> ComponentTagSupport.java:43)
>
> Thanks,
> Jon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message