我是春季 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".
你的网络.xml包含不必要的字符:"''">
正确的网络.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">