This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Displaying Timestamp object in a form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Displaying Timestamp object in a form" Watch "Displaying Timestamp object in a form" New topic

Displaying Timestamp object in a form

harpd dhillon

Joined: Jun 03, 2003
Posts: 8
I'm trying to display a field ( type timestamp) in the form on the browser. This is wut i tried to do:

and then:
out.println("<TR><TD width=150 align = right >");
out.println(" initialized: ");
out.println("<TD align = left >");
out.println("<INPUT type=text name=initialized value="(new SimpleDateFormat("EEE' 'YYYY/mm/dd' 'HH:mm:ss")).format((java.util.Date) +member.initialized + , new StringBuffer(),new FieldPosition(DateFormat.YEAR_FIELD)).toString();">");

Ofcourse, its not working..any suggestions or help would be greatly appreciated. thanks a lot
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
I would experiment with SimpleDateFormat outside the servlet environment until I got the desired result. Incidently, a SimpleDateFormat object is fairly expensive to create but can be used repeatedly if you keep it as an instance variable in your servlet. Just synchronize on it to avoid having two requests try to use it at once.
subject: Displaying Timestamp object in a form
Similar Threads
Value in dropdown from servlet
Connection Pooling
how to pass multiple values through hyperlink to a jsp page ?
How to retrive data two times from database in sinble jsp page.