Date Format in html:text in struts

Posted on 2007-10-05
Last Modified: 2009-10-06

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
Question by:iharsh
    LVL 8

    Accepted Solution

    If it's a Date object, the  best way to format it in JSP is to use the JSTL tag <fmt:formatDate>.
    LVL 1

    Expert Comment

    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).

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
    Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
    The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now