• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4645
  • Last Modified:

Date Format in html:text in struts

Hi,

In struts Action form, I have a date field.On Displaying it in JSP using html:text the format which was earlier mm/dd/yyyy automatically changes to yyyy-mm-dd.there is no "format" attribute available with the
html:text.Kindly let me know how do I preserve my date format using html:text
0
iharsh
Asked:
iharsh
1 Solution
 
malfunction84Commented:
If it's a Date object, the  best way to format it in JSP is to use the JSTL tag <fmt:formatDate>.

http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fmt/formatDate.html
0
 
jan42Commented:
Pass a string to the JSP instead of a Date object. That way you can control the formatting when converting from Date to String (using, e.g. SimpleDateFormatter).
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now