datepicker submit string instead of date

In my web application, i am using struts2 and freemarker. Locale setting is in French ("dd/MM/yyyy"). In my freemarker template, i defined jQuery ui datepicker in an input element with name attribute that points to my object's date attribute.

The Problem is that, on form submit, SOMETIMES i'm getting ognl warning saying "type conversion error - Cannot set String into the Date object.". In response i can see message cannot finc input results in my action. It's quite strange because the problem occurs sometimes, sometimes not...

In my page, i have a list of products, with inputs and names like product[1].startDate, product[2].startDate, etc which are linked in my action by a List.

I tried setting locale into the struts.properties to French and this quite helps, but still in 10% of the time i can see this problem.

Can anyone tell me how to map a datepicker to a Date object without ognl converting it to a string?

Answers


I think the problem could be due to String to Date conversion. Check two of my previous posts, here and here for conversion details. You can also check the javadoc of StrutsTypeConverter and DefaultTypeConverter.


Have you tried the dateFormat option when you call the .datepicker() function?

$( ".selector" ).datepicker({ dateFormat: "dd/MM/yyyy" });

Date picker allows you to select the format that's entered into the text field, and therefore passed on submission.


Need Your Help

Installation of a DER certificate in Chrome

google-chrome openssl certificate der

I'm having issues trying to automatically install a DER certificate with Chrome. The error reported back is Error 502 (net::ERR_NO_PRIVATE_KEY_FOR_CERT).

PHP compiler for windows

php windows compiler-construction

I have a command line php app that I need to distribute to a client. I just want to give them an executable, not instructions for installing php ;)