Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

formating date in jsp  RSS feed

 
Ranch Hand
Posts: 37
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi there,
My form has a date property in certain format. I'm trying to display it and send it back with a different format. Displaying it is easy with fmt:formatDate. The problem is when I return back that field back to the servlet it has the original format. Here's the code



I'm expecting this to return the item.date in that format i'm giving it, but im getting the original format when I debug into what I get dd-mm-yyyy.

Any ideas how i can achieve this?

Thanks!
 
Author and ninkuma
Marshal
Posts: 66685
167
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you are saying that the parameter is not being submitted as it is stored in the value attribute? I find that difficult to believe. Are you checking the HTTP request using a sniffing tool to see what's actually being submitted?
 
Bartender
Posts: 1844
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you are using struts/stripes which will automagically populate the component for you.

What is the type of ${item.date}?
For the purposes of the formatDate tag it needs to be a Date object. Not a String.

 
Screaming fools! It's nothing more than a tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!