views:

44

answers:

1

Why would the pageContext variable not be findable in this custom tag installed in the WEB-INF/tags directory of a Spring MVC app?

<%@ tag import="com.ocpsoft.pretty.time.PrettyTime, java.util.Date"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ attribute name="dateParam" required="true" type="java.util.Date" %>

<%
 PrettyTime p = new PrettyTime();
 String prettyDate = p.format(dateParam);
 pageContext.setAttribute("prettyDate", prettyDate);
%>
<c:out value="${prettyDate}"/>

The error is:

cannot find symbol
[javac] symbol  : variable pageContext

I thought this was an implicit variable that should be available by default.

+4  A: 

In tag files you should use jspContext instead of pageContext.

See also:

axtavt