ezequiel (2) [Avatar] Offline
#1
Hello!

I make this small script:

project --topLevelPackage org.sub.prueba3
jpa setup --provider ECLIPSELINK --database MYSQL --databaseName tiempoTest --userName root --password verde
entity jpa --class ~.dominio.TrabajoSocial --testAutomatically
field string --fieldName nombre --sizeMin 3 --notNull
field date --fieldName ingreso --type java.util.Date --persistenceType JPA_TIMESTAMP
field date --fieldName fechaHechos --type java.util.Date
field date --fieldName horaHechos --type java.util.Date --timeFormat SHORT --dateFormat NONE
field date --fieldName registro --type java.util.Date --dateTimeFormatPattern "dd-MM-yyyy hh:mm:ss a"
web mvc setup
web mvc all --package ~.web

But when I run and summit the form, I get the error:


Failed to convert property value of type java.lang.String to required type java.util.Date for property registro; nested exception is org.springframework.core.convert.ConversionFailedE xception: Failed to convert from type java.lang.String to type @javax.persistence.Temporal @org.springframework.format.annotation.DateTimeFor mat java.util.Date for value 16-05-2012 12:00:00 a.m.; nested exception is java.lang.IllegalArgumentException: Invalid format: "16-05-2012 12:00:00 a.m." is malformed at "a.m."

If I change the date format for example "05-16-2012 12:00:00 a.m." the view show a tool tip warning me of incorrect format.


I was researching why, but I don' get any clue. I make tests with spring roo 1.2.1 release and 1.2.0 RC1

thanks in advance.
srini.penchikala (20) [Avatar] Offline
#2
Re: --dateTimeFormatPattern and --timeFormat date & time error
Hi,

I looked at some java date examples online and they are using "PM" or "AM" for am/pm marker. I haven't tried this myself yet, but can you try with "AM" in your example?

Thanks
Srini
MikB (202) [Avatar] Offline
#3
Re: --dateTimeFormatPattern and --timeFormat date & time error
I have never managed to use the hours:minutes:seconds part and I forgot to make a bug report as I didn't need it.

Does it work at all with only "field date --fieldName registro --type java.util.Date --dateTimeFormatPattern "dd-MM-yyyy"?
ken.rimple (246) [Avatar] Offline
#4
Re: --dateTimeFormatPattern and --timeFormat date & time error
I'm pretty sure srini is right - it's not supposed to have period separators for AM or PM. am or pm will work.

Ken
ezequiel (2) [Avatar] Offline
#5
Re: --dateTimeFormatPattern and --timeFormat date & time error
Hello!

I uploaded screens of this error here:
http://www.servicioshotspot.com/internet-inalambrico/

And I did more tests:

if I enter to the input and try to change the date from "17-06-2012 12:00:00 a.m." to "17-06-2012 12:00:00 AM" the tooltip "please enter valid Registro" appear and when I tab to the next input the value is automatic changed to "17-06-2012 12:00:00 a.m."

I added a default locale:

<bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver" id="localeResolver" p:cookieName="locale">
<property name="defaultLocale" value="en"/>
</bean>

And the problem has gone but I would like to have the multilenguage posibilities like dojo calendar and localized texts.

Some idea where is the problem?

thank you.
ezequiel
ken.rimple (246) [Avatar] Offline
#6
Re: --dateTimeFormatPattern and --timeFormat date & time error
I think this is a problem where you may have to create your own custom Dojo date/time tag. If you can express the format properly in your locales, then you can use the <spring:message> tag to pull back the format and appropriately pass it to the Dojo script.

I'd then put the property with the date format in your application.properties file for the various locales and let Spring pull it appropriately.

I am not a big fan of the Dojo client widget configuration we have now in Roo, and am working (slowly) on a jsp lightweight mvc add-on. We'll see where it goes, but that's something I think Roo needs so that we can pull back and do a substitution quite easily in something like jQuery UI.
MikB (202) [Avatar] Offline
#7
Re: --dateTimeFormatPattern and --timeFormat date & time error
Incidentally this set of problems related with locale settings, the support from Roo which I find incomplete, was the start for me to turn away from Roo scaffolding and Dojo, to pure jsp or freemarker templates and jQuery. That and the fact the html produced wasn't what I wanted in every detail.

I'm still contemplating finding a way of working more with Roo scaffolding again, but I'm solving other issues first.