'cannot find symbol symbol: (maven and POM)

I finally fix nearly all that was wrong in my POM for maven compilation but there is still one wrong dependency (?) In my servlet class a have got 5 errors typeof

cannot find symbol
  symbol:   method getDispatcherType()
  location: variable request of type javax.servlet.http.HttpServletRequest
cannot find symbol
  symbol:   variable FORWARD
cannot find symbol
  symbol:   variable REQUEST

I have added in POM

<dependency>
            <groupId>javax.servlet.jsp.jstl</groupId>
            <artifactId>javax.servlet.jsp.jstl-api</artifactId>
            <version>1.2.1</version>
        </dependency>

and (http://mvnrepository.com/artifact/javax.servlet.jsp.jstl/javax.servlet.jsp.jstl-api/1.2.1)

<dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>javax.servlet.jsp-api</artifactId>
            <version>2.3.1</version>
        </dependency>

because getDispatcherType is from package javax.servlet; but it still couldn't find this methods, perhaps someone could tell me what is wrong in this POM description?

PS : org.glassfish.web:javax.servlet.jsp.jstl:1.2.1 is also present



Solution 1:[1]

You have the wrong dependency for jstl. You should be using:

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>jstl</artifactId>
  <version>1.2</version>
</dependency>

Your jsp dependency is correct.

Solution 2:[2]

finally after a hours of screwing around that piece of code I have found what exactly caused such trouble - the dependency of tomcat-servlet-api MUST BE FIRST in section. I am using 7.0.50 version by the way.

Solution 3:[3]

I am using InteliJ IDEA, I highlighted at the point where I am importing the packages import javax.servlet.jsp.JspException; and the IDE gave me an option of downloading Java version 6 (Java EE 6) dependencies. That fixed the problem for me

Solution 4:[4]

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
</dependency>

update the version if you like to do so

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Software Engineer
Solution 2 curiousity
Solution 3 Timothy Odhiambo
Solution 4 Puneetsri