日期:2014-05-18  浏览次数:20869 次

web.xml中的 <welcome-file-list>的困扰?
在web.xml中相关配置如下:

<welcome-file-list>
        <welcome-file> /test/index.jsp </welcome-file>
    </welcome-file-list>  

也就是设置欢迎界面。通过http://localhost/finaldesign/访问时,页面变得很乱了。且许多图片不能显示!

但通过http://localhost/finaldesign/test/index.jsp访问时,页面就变得正常了。

是 <welcome-file-list> 不能针对多级访问目录吗?

一定要通过struts才能达到那种需求吗?



------解决方案--------------------
<welcome-file> /test/index.jsp </welcome-file>

改为:
<welcome-fiel> test/index.jsp </welcome-file>
------解决方案--------------------
我的理解是 <welcome-file> 是指进入每个文件夹的默认页面
------解决方案--------------------
<welcome-file> /test/index.jsp </welcome-file>

那你不要这样写就可以了
写一个index.jsp在根目录中,里面再写
<HTML>
<HEAD>
<TITLE> index </TITLE>
</HEAD>

<BODY>
<SCRIPT LANGUAGE= "JavaScript ">
<!--
location.href= "test/index.jsp ";
//-->
</SCRIPT>
</BODY>
</HTML>


手工跳转到test目录中
------解决方案--------------------
要这么麻烦呀!
那还要 <welcome-file> 干什么?

welcome-file是用来指定在一个目录中默认的名字,并不是为了跳转到不同目录的

实际上welcome-file是起作用了,但是IE并不知道它跳转到新的目录中,
导致IE判断图片路径出现问题。


其实写一个页面我觉得要比welcome-file方便多了,又不需要重启服务器,多方便。