Back Forum Reply New

DateTimeFormat with pattern

Hi Folks,

i am working on a gui for my database, which is supposed to store archaeological data. For this reason dating is a crucial part of it. To do this, i like to use the SQL Date type and in my backing bean the java.util.calendar. Both allow datings before Christ.
The fields now look like this:

Code:   @Past   @Temporal(TemporalType.DATE)   @DateTimeFormat(pattern = quot;M.Y Gquot;)   private Calendar begining;
   @Past   @Temporal(TemporalType.DATE)   @DateTimeFormat(pattern = quot;M.Y Gquot;)   private Calendar ending;
As you can see, im using Pattern instead of style. This offers me the opportunity to use datings like 01.31 BC or 01.14 AD. But for some reason, if i chance the pattern into this:
CodeDateTimeFormat(pattern = quot;d.M.Y Gquot;) or  @DateTimeFormat(pattern = quot;dd.M.Y Gquot;)The Day is parsed wrong. If i type into my field, 01.01.31 BC and submit it to the database it changes to 05.01.31 BC. But the mistake don't happends in the Database, its the calendar object, which contains wrong data. So, somewhere between my input field and the backing-bean, something went wrong. Know i am asking you, where and why?

And there is another quit annoying behavior of roo if you use patterns. To represent dates, roo uses in the jspx file fmt:dateformat, and therefor you'll need a pattern, which is inserted in the controller into the modelMap. By default roo uses styles, if you now switch to pattern, roo deletes the variable in the controller, but not in the jspx, so as it turned out, nothing will be shown. If you insert the variables in question, roo deletes them from time to time, again. I guess this is intended and very usefull in normall circumestances, but how i turn this off?

Thank you for your answers in advance,
regards
Nils

Currently the MVC addon only parses the style attribute (which is localizable as opposed to patterns). If you need your own patterns you can easily achieve that by pushing the relevant controller ITD introduced methods and customizing the way patterns are generated. This way you have full control.

HTH,
Stefan

Yes, that helped.
I wasn't aware that roo automatically overrides the aspect methods.  
Thanks for the help.
¥
Back Forum Reply New