I'm trying to access the servlet path from a tag file like so;
<%@tag description="put the tag description here" pageEncoding="UTF-8"%>
<%=pageContext.getServletContext().getRealPath("/")%>
However it complains it cannot find the symbol; string:///xxxxx:89: cannot find symbol symbol : variable pageContext location: class org.apache.jsp.tag.web.xxxx
any suggestions on how to access that value in the tag file?
Since the expression appears within a tag file, pageContext
is not a valid implicit object. As you've noted, application
is valid, so is jspContext
(an instance of javax.servlet.jsp.JspContext
). On a related note, it is possible that getRealPath
will return null
...