Home > Enterprise >  Cannot resolve method getException() at JSP and Servlets
Cannot resolve method getException() at JSP and Servlets

Time:05-04

I have an issue with JSP file when i try to use "pageContext" in scritplet.

<%
String message = pageContext.getException().getMessage();
String exception = pageContext.getException().getClass().toString();%>

IDEA drops an error: "Cannot resolve method 'getException()'" but i tried this code in eclipse IDE too and everything was OK.

In my pom.xml file i have all servlets dependencies in.

<dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>4.0.1</version>
        <scope>provided</scope>
    </dependency>

CodePudding user response:

You need jsp-api dependency:

<dependency>
    <groupId>javax.servlet.jsp</groupId>
    <artifactId>jsp-api</artifactId>
    <version>2.2</version>
    <scope>provided</scope>
</dependency>

proof

  • Related