Web.xml中Element dispatcher is not allowed here

我不是女神ヾ 2022-11-18 15:00 252阅读 0赞

文章目录

  • 一、问题描述
  • 二、解决方案

一、问题描述

在这里插入图片描述

二、解决方案

IDEA通过Maven构建的Web工程,默认web.xml的版本为2.3 ,由于版本太低,会导致web.xml在添加配置的时候出现问题
为了不出问题,我们可以直接将tomcat里面的web.xml头部拿过来
在这里插入图片描述
在这里插入图片描述

我们将文件的头部改为:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
  5. http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">

头部修改之后:
在这里插入图片描述

可以看到,已经识别标签了

发表评论

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

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

相关阅读