• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4776
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

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