Maven 搭建springMVC 报错 maven web.xml param element param-name is not allowed here

1.在使用maven构建springMVC时,配置web.xml文件中配置xml文件路径

<init-param>
            <param-name>contextConfigLocationparam-name>
            <param-value>classpath:param-value> (不是系统默认WEB-INF时,需用classpath*:)
init-param>

提示 param element param-name is not allowed here

2.解决办法:

将web.xml头部内容

<web-app 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 xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">

 

转载于:https://www.cnblogs.com/jeesezhang/p/4344309.html

你可能感兴趣的:(java,web.xml)