Element filtername is not allowed here-web.xml version="3.0"-intellij idea

 Element filtername is not allowed here-web.xml version="3.0"-intellij idea

Intellij IDEA 报错,web.xml不能添加 filter:

参见:

http://stackoverflow.com/questions/17563756/element-listener-class-not-allowed-in-my-web-xml

解决方法:

web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"



What's the purpose of xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"? Will it work if you remove it?

删除红色的部分即可。

原文地址:https://www.cnblogs.com/slankka/p/9158526.html