简体   繁体   中英

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 ?

最终servlet-api.jar应该在类路径中,即WEB-INF \\ lib文件夹下

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM