I am writing a JSP that sometimes needs to format the Java date that comes out of the request. I do it like this:
<fmt:formatDate value="${attribute.value}" pattern="yyyy-MM-dd HH:mm:ss"/>
and it works great on Java Dates.
However, there are times when a request attribute field with the same name ( attribute.value) is not really a date and should not be formatted as such. What I would like to do is simply pass this line through the fmt:formatas-is tag , and not throw an exception on the failed validation date.
I could do something similar with c:choose, but I would rather separate the JSP presentation from the underlying data as much as possible, so this is not an ideal choice for me. So, is there a way to do something like
<fmt:formatDate value="I AM NOT A DATE" pattern="yyyy-MM-dd HH:mm:ss"/>
just appreciate
I AM NOT A DATE
in generated HTML?