【报错】cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'.

一、产生问题描述或背景

1.错误描述:

在建好的项目下创建servlet,采取右键new-servlet的方法。

web.xml之前是正常创建并且更新的,但是在web.xml出现错误之后就不再自动更新。

【报错】cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'.

2.报错情况

cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'. One of 

 '{"http://xmlns.jcp.org/xml/ns/javaee":servlet-class, "http://xmlns.jcp.org/xml/ns/javaee":jsp-file, "http://

 xmlns.jcp.org/xml/ns/javaee":init-param, "http://xmlns.jcp.org/xml/ns/javaee":load-on-startup, "http://

 xmlns.jcp.org/xml/ns/javaee":enabled, "http://xmlns.jcp.org/xml/ns/javaee":async-supported, "http://

 xmlns.jcp.org/xml/ns/javaee":run-as, "http://xmlns.jcp.org/xml/ns/javaee":security-role-ref, "http://

 xmlns.jcp.org/xml/ns/javaee":multipart-config}' is expected.

二、解决方案

删掉报错的所在行代码

通过查资料,知道display-name 和 description 均属于描述性标签,则可删掉,程序也能运行。