• Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting Date to String in JSP  RSS feed

 
Manoj Paul
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help....
wat should i do to convert Date to String in my JSP Page?
Thank you....
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use Scriptlets(<% [java code] %>)and placing your java code between <% and %>.
 
Stefan Evans
Bartender
Posts: 1834
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest the JSTL <fmt:formatDate> tag.
Or do the date formatting in a bean, and just get the property on the page.
The java class to use would be java.text.SimpleDateFormat.

Putting scriptlet code on a jsp page is generally not considered best practice
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Stefan Evans:
do the date formatting in a bean, and just get the property on the page.
The java class to use would be java.text.SimpleDateFormat.

Putting scriptlet code on a jsp page is generally not considered best practice


indeed.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!