在web.xml文件中的此行找到多个注释

时间:2017-12-31 10:17:40

标签: java spring spring-mvc web.xml

我在创建示例应用程序时是初次使用spring mvc我在web.xml文件中有错误。

这是我的网络应用标签:

<web-app id="WebApp_ID" 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">   

我收到错误:

在此行找到多个注释:

- Attribute "version" must be declared for element type "web-app".
- Attribute "xsi:schemaLocation" must be declared for element type "web-app".
- 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-mapping*,welcome-file-list?,error-
 page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
- Attribute "xmlns" must be declared for element type "web-app".
- Attribute "xmlns:xsi" must be declared for element type "web-app".

1 个答案:

答案 0 :(得分:0)

您的web.xml包含不必要的字符: 的&#34;``&#34;

正确地使用web.xml:

<web-app id="WebApp_ID" 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">