The moose likes Spring and the fly likes Is this the best way to format dates in Spring? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Spring
Reply Bookmark "Is this the best way to format dates in Spring?" Watch "Is this the best way to format dates in Spring?" New topic
Author

Is this the best way to format dates in Spring?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 388
Hi,

I'm using Spring 3.0. I wanted to take advantage of Spring forms, so I had



where endDate is a java.util.Datefield of my command object. However, I notice that the date is printed out in verbose format, and I would prefer to apply a formatting to it. The only way I have found so far is to abandon Spring forms and go with



I don't like this mixed Spring form/non-Spring form approach and so I wanted to ask if there's something I'm missing or if this is the only way to do it.

Thanks, - Dave
Christophe Verré
Marshal

Joined: Nov 24, 2005
Posts: 14361

Instead, you can take advantage of Spring 3 Field Formatting.


[SCBCD Wall of Fame] [My Blog]
All roads lead to JavaRanch
Help Japan. Make a donation.
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

Personally, I would never use a proprietary tag when a standard one is available. I have no problem with a "mixed approach" that involves the JSTL.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
 
subject: Is this the best way to format dates in Spring?
 
Threads others viewed
How to compare jstl value with String value
Enabling / disabling forms (Struts)
How to merge 2 columns in display tag
date format problem
html:text how to set id attribute
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture