在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才能达到那种需求吗?

解决方案 »

  1.   

    <welcome-file>/test/index.jsp</welcome-file>改为:
    <welcome-fiel>test/index.jsp</welcome-file>
      

  2.   

    我的理解是<welcome-file>是指进入每个文件夹的默认页面
      

  3.   

    <welcome-file>/test/index.jsp</welcome-file>改为:
    <welcome-fiel>test/index.jsp</welcome-file>
    --------------------------------
    谢谢你的回复!
    但不是这样的,通过http://localhost/finaldesign/能访问到index.jsp页面,
    只是页面变得很乱了,且许多图片不能显示!
      

  4.   

    <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目录中
      

  5.   

    写漏了
    去掉<welcome-file>/test/index.jsp</welcome-file>声明
      

  6.   

    写一个index.jsp在根目录中,里面再写
    <HTML>
    <HEAD>
    <TITLE>index</TITLE>
    </HEAD><BODY>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    location.href="test/index.jsp";
    //-->
    </SCRIPT>
    </BODY>
    </HTML>
    手工跳转到test目录中
    -------------------------
    要这么麻烦呀!
    那还要<welcome-file>干什么?
      

  7.   

    要这么麻烦呀!
    那还要<welcome-file>干什么?welcome-file是用来指定在一个目录中默认的名字,并不是为了跳转到不同目录的实际上welcome-file是起作用了,但是IE并不知道它跳转到新的目录中,
    导致IE判断图片路径出现问题。
    其实写一个页面我觉得要比welcome-file方便多了,又不需要重启服务器,多方便。