0

I am getting a IDE error with JSP files containing the following EL snippet:

The error is: Null pointer access: The variable pageContext can only be null at this location

IDE: Spring Tool Suite 4.11 (Eclipse 4.20) Container: Tomcat 9 JDK: AdoptOpen JDK 11

The issue appears to be only within the IDE - there is no runtime issue.

Here are the relevant portions of the pom.xml

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>4.0.1</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>javax.servlet.jsp</groupId>
    <artifactId>javax.servlet.jsp-api</artifactId>
    <version>2.3.3</version>
    <scope>provided</scope>
</dependency>
Fred
  • 335
  • 1
  • 6
  • 22

1 Answers1

0

i was making it more difficult than necessary. Solution is:

<input type="hidden" id="pageContextRequestPath" value="<c:url value="/" />" />

note: this solutions requires the following standard tag library

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
Fred
  • 335
  • 1
  • 6
  • 22