Erlaunis
Erlaunis

Reputation: 1451

Package javax.servlet.jsp error

I have an error in a .jsp file in my java ee project : package javax.servlet.jsp does not exist. I have searched why and I found that with Maven, we need to add a dependency into the pom.xml. But I already have this dependency :

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

When I build the project, it tells me "BUILD SUCCESSFUL" but I still have this error. Is there anything I need to add somewhere else please ?

Upvotes: 0

Views: 621

Answers (2)

question_maven_com
question_maven_com

Reputation: 2475

Try this:

<dependency>
<groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    <scope>provided</scope>
</dependency>

Upvotes: 1

M Sach
M Sach

Reputation: 34424

ultimately servlet-api.jar should be in classpath i.e under WEB-INF\lib folder

Upvotes: 1

Related Questions