简体   繁体   English

元素web-app必须在intellij中声明错误(java,springmvc,maven)

[英]Element web-app must be declared error in intellij (java,springmvc,maven)

this is my web.xml file which getting element web-app must be declared error 这是我的web.xml文件,必须声明获取元素web-app错误

<web-app id="WebApp_ID" version="2.5"
    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_5.xsd">

    <display-name>SpringMVC 3.2 + Google Chart</display-name>

    <servlet>
        <servlet-name>frontController</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>WEB-INF/applnConfig.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>frontController</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

</web-app>

You are using the deployment descriptor schema (web-app_2_5.xsd) version 2.5 which is in javaee namespace ( http://java.sun.com/xml/ns/javaee ). 您正在使用javaee名称空间( http://java.sun.com/xml/ns/javaee )中的部署描述符模式(web-app_2_5.xsd)版本2.5。 But You have given J2ee namespace instead ( http://java.sun.com/xml/ns/j2ee ). 但是您已经给了J2ee命名空间( http://java.sun.com/xml/ns/j2ee )。

Try using the Java EE 7 namespace: 尝试使用Java EE 7命名空间:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
     version="3.1">
</web-app>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM