Date conversion in JSP via JSTL from XMLCalendar to util date -
i trying convert xmlcalendar date normal date format rendering on jsp page. while using below tag getting exception:
<fmt:formatdate value="${xmlcalendardate}" pattern="dd/mm/yyyy" /> with tag getting exception as
java.lang.illegalargumentexception: cannot convert 2015-07-02t21:33:35z of type class org.eclipse.emf.ecore.xml.type.internal.xmlcalendar class java.util.date is there other tag or other approach render date on jsp page.
thanks in advance.
that's subclass of xmlgregoriancalendar. can java.util.date out of first obtaining java.util.calendar via xmlgregoriancalendar#togregoriancalendar() , calling calendar#gettime() on it.
so, assuming el 2.2 capable environment, should do:
<fmt:formatdate value="${xmlcalendardate.togregoriancalendar().time}" pattern="dd/mm/yyyy" /> if you're not on el 2.2 yet (which standard part of servlet 3.0 / java ee 6), you'd need perform xmlgregoriancalendar date conversion in front controller first.
date date = xmlcalendardate.togregoriancalendar().gettime(); // ...
Comments
Post a Comment