当前位置:编程学习 > JAVA >>

关于web.xml中配置文件的加载顺序问题

<?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_2_5.xsd" 
id="WebApp_ID" version="2.5">


 <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>customer/loadIndexAction!load.action</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>
应该先去哪个<welcome-file>里 web.xml Web --------------------编程问答-------------------- welcome-file-list元素可以包含一个或多个welcome-file子元素。如果在第一个welcome-file元素中没有找到指定的文件,Web容器就会尝试显示第二个,以此类推。 --------------------编程问答--------------------
引用 1 楼 longtian1213 的回复:
welcome-file-list元素可以包含一个或多个welcome-file子元素。如果在第一个welcome-file元素中没有找到指定的文件,Web容器就会尝试显示第二个,以此类推。
+1 --------------------编程问答-------------------- 从上往下的。 --------------------编程问答--------------------
引用 楼主 mockingbirds 的回复:
<?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_2_5.xsd" 
id="WebApp_ID" version="2.5">


 <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>customer/loadIndexAction!load.action</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>
应该先去哪个<welcome-file>里



那要是前边的<welcome-file>没找到,直到第三个才找到,后边的是不是就不用加载了 --------------------编程问答-------------------- ying gai shi de --------------------编程问答-------------------- 是的 依次往下加载的,找到了的话 后面的就不加载了的
--------------------编程问答-------------------- 学习了 --------------------编程问答-------------------- 从上往下加载的! --------------------编程问答--------------------   从上往下找到有那个文件就执行那个
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,