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,
pageContextis not a valid implicit object. As you’ve noted,applicationis valid, so isjspContext(an instance ofjavax.servlet.jsp.JspContext). On a related note, it is possible thatgetRealPathwill returnnull…