web.xml版本控制 [英] web.xml Versioning

查看:103
本文介绍了web.xml版本控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Eclipse中构建一个Web应用程序,并在 web.xml中获取版本问题

I am building a web application in Eclipse and get a version issue in 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">

错误是:

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

项目方面显示动态Web模块和Servlet API的2.4版。

The project facet shows version 2.4 for both the Dynamic Web Module and the Servlet API.

推荐答案

如果您将Eclipse中的应用程序声明为2.5应用程序,并说您的Web应用程序版本为2.4,但链接到架构2.5版本( web-app_2_5.xsd ),它显然不起作用

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

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

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

这篇关于web.xml版本控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆