I have a class which retrieves its data from the database. One of the attributes of the object of the model is a java.sql.Date
, which stores the date as yyyy-mm-dd
(as System.out.println
shows).
When in my .jsp
pages I read that information, it shows it as d/mm/yy
without my intervention. I suppouse it's because of my locale configuration (es-ES
). I want to rewrite that in order to show dd/mm/yyyy
. How can I achieve this?
To show dates on JSP use Struts2 <s:date>
tag which has format
attribute.
<s:date name="date" format="dd/MM/yyyy" />
With <s:date>
tag you can also use struts.date.format
in your properties file to define default date format.