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

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

<init-param>
            <param-name>contextConfigLocation</param-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">

 

posted @ 2015-03-17 14:27  天外飞仙丶  阅读(8303)  评论(1编辑  收藏  举报