Question

I'm using the tag datetimepicker in my struts2 2.0.11 app with the folowing tag:

<s:datetimepicker name="data" displayFormat="dd/MM/yyyy"/>

In my action there is a field of the type util.Date named data with the correct getter and setter. If the user uses the calendar to pick the day, it works fine, but if one "accidently" writes an invalid date it throws a parse exception (as expected) and when the form reapears the datetimepicker has the days replaced by NaN and the calender becomes unusable.

Interesting, I wasn't able to find anything in Google about this simple error.

Thanks in advance, Saul

Was it helpful?

Solution

I finally found an answer for my question:

<s:datetimepicker name="remocao.criacao" value="" displayFormat="MM/dd/yyyy"/>

That's all! =) I just needed to put the attribute value with no value and it worked! It gives now the exception java.text.ParseException: Unparseable date: "", but it does no harm.

Thanks again, Saul

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top