Newbie: Web.xml Eclipse. xsi:schemaLocation & xmlns:web

拜拜、爱过 提交于 2019-12-12 04:47:12

问题


2.5 xsd and 3.0 xsd. Why there are 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:


Because your autogenerator (you generate this code with?) of Web.xml choice the last and better version for your xmlns:web and for your xsi:schemaLocation.

It's not a problem to have different xsd version on 2 elements of the web.xml I think. If you have a problem go to 2.5 version.

I see you are using JSP, maybe it's better to look to JSF2.0 + Primefaces 3.2 ?



来源:https://stackoverflow.com/questions/10829350/newbie-web-xml-eclipse-xsischemalocation-xmlnsweb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!