• Post Reply Bookmark Topic Watch Topic
  • New Topic

formating date in jsp  RSS feed

 
Klament J. Kruoghst
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!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
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?
 
Stefan Evans
Bartender
Posts: 1836
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.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!