报错原因

问题描述 : 在创建 SpringMVC 时 , 选用 idea 的 webapp 模板来创建 , xml 配置文件中进行配置时发现提示警告

警告如下:

这错误大概的意思就是:必须要匹配这个顺序。

解决方案

由于 web.xml 头文件比较旧。规定了代码的书写顺序所以报错。要么按照规定的顺序写代码。要么删除规定。但是删除规定会导致智能提升失效。

这里可以使用一些其他版本的 web.xml 的头文件来进行 web.xml 文件的配置

web.xml v2.3

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app> </web-app>

web.xml v2.4

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> </web-app>

web.xml v2.5

 <?xml version="1.0" encoding="UTF-8"?>
<web-app 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_2_5.xsd" version="2.5"> </web-app>

web.xml v3.0

 <?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">
</web-app>

The content of element type “web-app“ must match 解决方法的更多相关文章

  1. web.xml配置bug之提示The content of element type "web-app" must match "(icon?,display- name?,description?,distributable?,

    错误:配置web.xml时,出现红色叉叉,提示 The content of element type "web-app" must match "(icon?,disp ...

  2. The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet- mapping*,session-config?,mime-map

    修改了一下web.xml,加入了一个<filter>,然后就报这样的错??? The content of element type "web-app" must ma ...

  3. mybatis项目启动报错 The content of element type "resultMap" must match "(constructor?,id*,result*,association*,collection*,discriminator?)".

    启动项目报错 2018-02-26 17:09:51,535 ERROR [org.springframework.web.context.ContextLoader] - Context initi ...

  4. Multiple annotations found at this line: - The content of element type "mapper" must match "EMPTY". - Attribute "namespace" must be declared for element type "mapper".

    今天在mybatis的mapper映射配置文件中遇到了这样的问题,困扰了我3个小时: Multiple annotations found at this line: - The content of ...

  5. The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,reflectorFactory?,plugins?,environments?,databaseIdProv

    在mybatis配置文件config.xml中报错: The content of element type "configuration" must match "(p ...

  6. The content of element type "package" must match "(result-types?,interceptors?...

    错误:“The content of element type "package" must match "(result-types?,interceptors?,de ...

  7. The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?...

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC & ...

  8. The content of element type "sqlMapConfig" is incomplete,

    The content of element type "sqlMapConfig" is incomplete, it must match "(properties? ...

  9. 【转】The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?...

    [转]The content of element type "configuration" must match "(properties?,settings?,typ ...

  10. The content of element type "beans" must match "(description?,(import|alias|bean)*)

    The content of element type "beans" must match "(description?,(import|alias|bean)*) - ...

随机推荐

  1. 看我如何用定值 Cookie 实现反爬

    摘要:本次案例,用定值Cookie实现反爬. 本文分享自华为云社区<我是怎么用一个特殊Cookie,限制住别人的爬虫的>,作者: 梦想橡皮擦 . Cookie 生成 由于本案例需要用到一个 ...

  2. 代码Bug太多?给新人Code Review头都大了?快来试试SpotBugs

    如果你需要一个自动化的工具帮助你或者你的团队发现代码中的缺陷,在提升代码质量同时减少人工Code Review的成本,那这篇文章非常的适合你.本文围绕SpotBugs与Gradle集成,将相关配置和使 ...

  3. What's the best way to read and understand someone else's code?

    Find one thing you know the code does, and trace those actions backward, starting at the end Say, fo ...

  4. 介绍一下js垃圾回收机制

    JavaScript中的垃圾回收机制负责自动管理内存,回收不再使用的对象所占用的内存空间.在JavaScript中,开发者不需要显式地分配和释放内存,垃圾回收器会自动完成这些操作.以下是关于JavaS ...

  5. HOOPS Exchange助力Shapr3D产品实现了“无障碍的用户体验”

    HOOPS SDK是用于3D工业软件开发的工具包,其中包括4款工具,分别是用于 读取和写入30多种CAD文件格式的HOOPS Exchange.专注于Web端工程图形渲染的HOOPS Communic ...

  6. day66:Linux:nginx+uwsgi+django跑python项目

    目录 0.uwsgi简述 1.使用uwsgi+django运行demo 2.nginx+uwsgi+django跑pythonav项目 0.uwsgi简述 1.什么是wsgi WSGI,全称Web S ...

  7. 为什么C++语言性能优越?

    面试时被问到这个问题,发现自己一直以来理所当然的认为C++快,却没有具体分析原因.下面简单总结一下为什么快. 当我们编写程序时,我们需要将程序转换为计算机可以理解的机器语言.不同的语言有不同的执行机制 ...

  8. .Net 6.0 部署Linux+Nginx +PM2教程

    今天带大家将本地.Net6.0项目部署到Linux系统中,其中有用到Nginx反向代理和PM2进程管理工具,希望本偏文章能对你有所帮助,成为你成功路上的垫脚石! 背景: 在.Net 5.0横空出世之后 ...

  9. 【vue3-element-admin 】基于 Vue3 + Vite4 + TypeScript + Element-Plus 从0到1搭建后台管理系统(前后端开源@有来开源组织)

    vue3-element-admin 是基于 vue-element-admin 升级的 Vue3 + Element Plus 版本的后台管理前端解决方案,技术栈为 Vue3 + Vite4 + T ...

  10. 高阶函数_函数柯里化 以及 setState中动态key

     使用柯里化: 1 state = { 2 username: "", 3 password: "", 4 }; 5 render() { 6 return ( ...