【问题标题】:Multiple annotation found at this line in web.xml file在 web.xml 文件的这一行发现多个注释
【发布时间】:2017-12-31 10:17:40
【问题描述】:

我是 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".

【问题讨论】:

  • 分享你的完整web.xml文件
  • 请出示您的 web.xml 文件。
  • 嗨,感谢您的 cmets,我的问题已解决。问题是我没有在我的 xml 文件中添加 xml 版本

标签: java spring spring-mvc web.xml


【解决方案1】:

您的 web.xml 包含不必要的字符: "``"

正确的 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">

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-11
    • 1970-01-01
    • 1970-01-01
    • 2014-03-11
    • 1970-01-01
    • 2019-10-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多