• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

formating date in jsp

 
Ranch Hand
Posts: 37
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic