新建Maven web项目后jsp页面会报错。以下给出两种解决方案:
一、导入javax.servlet.http.HttpServlet.jar依赖
<dependencies> ???<dependency> ?????<groupId>junit</groupId> ?????<artifactId>junit</artifactId> ?????<version>3.8.1</version> ?????<scope>test</scope> ???</dependency> ???<!-- maven新建项目后需导入javax.servlet否则jsp页面报错 --> ???<dependency> ???????<groupId>javax.servlet</groupId> ???????<artifactId>javax.servlet-api</artifactId> ???????<version>3.1.0</version> ???????<scope>provided</scope> ???</dependency> ?</dependencies>
二、添加服务器运行环境
这里如果已经存在Tomcat就直接finish.如果没有接着添加。
然后继续上面的操作。我就不重复了。结束之后jsp页面便不再报错了。
Maven新建web项目jsp报错
原文地址:https://www.cnblogs.com/JonlyZhang/p/9860536.html