解决在web.xml中添加filter后idea提示错误的问题 web-app爆红
1.更改
web.xml中文件为以下,web-app就不会爆红,建议换成和Tomcat一样的webxml。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
</web-app>
把项目所引用的jar包,整体复制一份到本地Tomcat的lib文件夹中,然后重启Tomcat,即可解决。
另外可参考以下2篇文章
Tomcat项目一直ERROR 由于之前的错误,Context[]启动失败
tomcat启动失败( org.apache.catalina.core.StandardContext.startInternal 由于之前的错误,Context[]启动失败)
附上用的jar包。使用
<dependencies>
<!--servlet依赖-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
<!--jsp依赖-->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/jstl-api -->
<!-- JSTL表达式依赖 jstl里面有一些表达式之类的在jsp中可以用 ,jstl依赖于standard-->
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/taglibs/standard -->
<!--standard标签库 -->
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<!--连接数据库-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.47</version>
</dependency>
</dependencies>```