If you want to use
<fmt:formatDate pattern="${headerDateFormat}" value="${now}" />
(which is actually correct )
then you should put it as an attribute in one of the areas of the page, request, session or application with this name as the key. Assuming you want to put it in the request area of ββthe servlet:
String headerDateFormat = "EEE, d MMM yyyy h:mm:ss aa"; request.setAttribute("headerDateFormat", headerDateFormat);
You can also use JSTL <c:set> for this.
<c:set var="headerDateFormat" value="EEE, d MMM yyyy h:mm:ss aa" />
it will be installed in the page area by default.
See also:
- Our JSP Wiki Page - A Short Introduction to JSP
Balusc
source share