在有网的情况下 eclipse会连接到sun网站校验xsd,这时会耗费很长时间;还有的同志是xml版本和Servers版本不同的问题。在这里只介绍前一种的解决方式,后一种请直接百度即可。
这里给个文件的下载地址好了(虽然上面直接粘贴就有): http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd
其他dtd去这里找:http://xmlns.jcp.org/xml/ns/javaee
下好后最好新建一个文件夹存放相关的dtd文件,这样以后好管理,放好以后的操作:
步骤一:
步骤二:
完成:
完成以后重启Eclipse,更改XML文件不会再卡顿和假死
注意:如果还有卡顿,就新建一个Next Catalog,再点击file System传入相关对应文件(具体原因不明,不过亲测有用)
5.22更新:
每次改完后好好地,重启又开始出问题,简直了。最后找到最终的解决方式,我的是Tomcat 9,本来对应的版本是4.0,但是4.0太卡了,改成3.0后就不卡了。3.0版本的web.xml默认内容如下,直接粘贴即可:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
metadata-complete="false">
<display-name>web</display-name>
<description>
Welcome to Tomcat
</description>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>