The content of element type "web-app" must match

桃扇骨 2022-03-02 05:48 325阅读 0赞

推荐阅读
●网站推荐
●软件推荐
●点击加入QQ群874514813交流学习,免费获取达内-黑马全套培训资料

异常信息

  1. The content of element type "web-app" must match "(icon ,display-
  2. name ,description ,distributable ,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-
  3. mapping*,session-config ,mime-mapping*,welcome-file-list ,error-page*,taglib*,resource-env-
  4. ref*,resource-ref*,security-constraint*,login-config ,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
  5. - No grammar constraints (DTD or XML schema) detected for the document.

场景描述

项目为idea自动创建的 maven工程,使用webapp archetype自动生成的web.xml

在整合spring和springMVC的时候需要在web.xml中添加spring的容器配置

  1. <context-param>
  2. <param-name>contextConfigLocation</param-name>
  3. <param-value>classpath:spring/applicationContext-*.xml</param-value>
  4. </context-param>
  5. <listener>
  6. <listener-class>org.springframework.web.context.ContextLoaderListener
  7. </listener-class>
  8. </listener>

添加前没有异常,添加后web-app标签红线异常。


异常原因

文档内容标签顺序不符合web-app_2_3.dtd规范


解决方案

方案一:严格按照提示上的顺序排列
方案二:删除


参考资料

这里是引用
WEB.XML详解:https://www.cnblogs.com/vanl/p/5737656.html
解决问题:https://jyao.iteye.com/blog/1263650

发表评论

表情:
评论列表 (有 0 条评论,325人围观)

还没有评论,来说两句吧...

相关阅读