I'm having a small problem with a JSP page. I'm using Stripes as framework but this should not be that relevant.
Basically I have a bean that returns via a getter a date in the form of a GregorianCalendar
.
I have to display this date in JSP. When I try:
<fmt:formatDate type="both" dateStyle="full" value="${myObject.itsGregorian}">
I get an exception saying that he is unable to convert GregorianCalendar
to Date
.
I understand that fmt:formatDate
formats a Date
object and not a GregorianCalendar
, but is there a way to turn around it?
Since this is an assignment and I've got a pre-coded Bean I'm not allowed to touch the bean, so I can't transform its getter for the date to return a Date
.
How can I solve this the best?
full
. Read theDateFormat
javadoc for examples: download.oracle.com/javase/6/docs/api/java/text/DateFormat.html You can also use thepattern
attribute. Read theSimpleDateFormat
javadoc for examples: download.oracle.com/javase/6/docs/api/java/text/… If you stucks, just pressAsk Question
on right top :) – Bloodstained