【记录】MyEclipse下web.xml报错Invalid content was found starting with element 'display-name'
来源:互联网 发布:软件测试入门书籍 编辑:程序博客网 时间:2024/06/06 03:29
新建一个Web Project之后,添加了一个servlet,MyEclipse自动生成web.xml:
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>MyServlet</display-name> <servlet> <servlet-name>TestServlet</servlet-name> <display-name>TestServlet</display-name> <description>Test of Servlet</description> <servlet-class>com.anudesty.TestServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>TestServlet</servlet-name> <url-pattern>/servlet/TestServlet</url-pattern> </servlet-mapping> <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>
第7行<display-name>标签报错
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.
不管它也可以,项目正常运行
上网找办法:多是改动
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
最终是将
<display-name>TestServlet</display-name>移动到
<servlet-name>TestServlet</servlet-name>上面
然而
<description>Test of Servlet</description>又报错
再移到<display-name>上面,问题解决,最终是这样的
<span style="font-family:SimSun;"><?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>MyServlet</display-name> <servlet> <description>Test of Servlet</description> <display-name>TestServlet</display-name> <servlet-name></span><span style="font-family: SimSun;">TestServlet</span><span style="font-family: SimSun;"></servlet-name></span><span style="font-family:SimSun;"> <servlet-class>com.anudesty.TestServlet</servlet-class> </servlet></span>
0 0
- 【记录】MyEclipse下web.xml报错Invalid content was found starting with element 'display-name'
- eclipse validator - Invalid content was found starting with element 'display-name' in web.xml
- web.xml 报错cvc-complex-type.2.4.a: Invalid content was found starting with element 'cookie-config'...
- cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'.
- cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'. One of '{"
- xml报错解决:cvc-complex-type.2.4.a: Invalid content was found starting with element
- 配置web.xml中的 Invalid content was found starting with element 'init-param'.错误
- dwr错误cvc-complex-type.2.4.a: Invalid content was found starting with element 'display- name'. One o
- Web.xml配置<taglib>标签报错问题(cvc-complex-type.2.4.a: Invalid content was found starting with element 'tag
- 报错cvc-complex-type.2.4.a: Invalid content was found starting with element 'async-supported'
- web项目web.xml出现cvc-complex-type.2.4.a: Invalid content was found starting with element
- 解决XML中报“cvc-complex-type.2.4.a: Invalid content was found starting with element ”错误
- eclipse 中web.xml错误:cvc-complex-type.2.4.a: Invalid content was found starting with element
- ActiveMQ Invalid content was found starting with element
- Invalid content was found starting with element 'taglib'错误 .
- spring Invalid content was found starting with element 'init- param'
- Invalid content was found starting with element 'taglib'”
- Invalid content was found starting with element 'mvc:exclude-mapping'.
- Problem A ASCII码排序
- URAL 1787. Turn for MEGA
- [湖大热身赛]Tractor(数学?)
- 日志文件设置归档目标
- 浅析数组与指针的联系与区别2
- 【记录】MyEclipse下web.xml报错Invalid content was found starting with element 'display-name'
- Android NDK几点回调方式
- 【bzoj1927】【SDOI2010】【星际竞速】【bzoj1877】【SDOI2009】【晨跑】
- 欢迎使用CSDN-markdown编辑器
- 垃圾收集与内存分配 - 《深入理解Java虚拟机》ch03笔记
- 深入JVM系列(一)之内存模型与内存分配
- TCP-IP协议详解(1)邮差与邮局 (网络协议概观)
- Quartz.NET学习系列(二)--- 简单触发器
- C#_label值清空