简体   繁体   English

web.xml版本控制

[英]web.xml Versioning

I am building a web application in Eclipse and get a version issue in web.xml : 我在Eclipse中构建Web应用程序并在web.xml获取版本问题:

<web-app version="2.4" xmlns="java.sun.com/xml/ns/javaee"
   xmlns:xsi="w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="java.sun.com/xml/ns/javaee java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

The error is: 错误是:

cvc-enumeration-valid: Value '2.4' is not facet-valid with respect to enumeration '[2.5]'.
It must be a value from the enumeration.

The project facet shows version 2.4 for both the Dynamic Web Module and the Servlet API. 项目方面显示了动态Web模块和Servlet API的2.4版本。

If you declare your app in Eclipse to be a 2.5 app, and say that your web-app version is 2.4, but link to the schema of the 2.5 version ( web-app_2_5.xsd ), it will obviously not work 如果您将Eclipse中的应用程序声明为2.5应用程序,并且说您的Web应用程序版本是2.4,但链接到2.5版本的架构( web-app_2_5.xsd ),它显然不起作用

<web-app version="2.4" 
         xmlns="java.sun.com/xml/ns/javaee"
         xmlns:xsi="w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="java.sun.com/xml/ns/javaee 
                             java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
                                                                 ^-- HERE!

Use the 2.4 version: 使用2.4版本:

<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">

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

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