新手:Web.xml Eclipse。 xsi:schemaLocation&的xmlns:网络

时间:2012-05-31 07:42:00

标签: eclipse java-ee java-ee-6

2.5 xsd和3.0 xsd。为什么有2个xsd?

Project Spec:
    Server info: Apache Tomcat/7.0.27
     Servlet version: 3.0
     JSP version: 2.1
     Java version: 1.6.0_32


<?xml version="1.0" encoding="UTF-8"?>
<web-app 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
id="WebApp_ID" version="3.0">
  <display-name>MyFirstApp</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

1 个答案:

答案 0 :(得分:3)

因为您的自动生成器(您使用?生成此代码)选择了xmlns:web和xsi:schemaLocation的最新版本和更好版本。

我认为在web.xml的2个元素上使用不同的xsd版本不是问题。如果您有问题请转到2.5版本。

我看到你正在使用JSP,也许最好看看JSF2.0 + Primefaces 3.2?

相关问题