我在项目根目录下有个文件index.xtml,在web.xml 配置了 如下:
<welcome-file-list>
<welcome-file>index.xtml</welcome-file>
</welcome-file-list>index.xtml内容如下:<%@ page contentType="text/html; charset=utf-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script language="javascript">
window.location="/indexWeb.htm";
</script>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
</body>
</html>在IE浏览器下输入http://localhost:8081
可以自动跳到http://localhost:8081/indexWeb.htm
但在火狐浏览器输入http://localhost:8081
显示和index.xtml 一样的内容 根本没有解析,还有就是我直接输入://localhost:8081/index.xtml也是一样没有解析出来
求高手如何解决
急。。谢谢

解决方案 »

  1.   

    为什么要写成.xtml?.html不好么?
      

  2.   

    你把index.xtml改为index.html试试看?或者jsp也行估计.xtml不解析javascript,就像txt不解析javascript一样。
      

  3.   

    其他html  jsp 肯定是可以的
      

  4.   

    你为什么要把扩展名写成xtml?什么是xtml?你写的不就是个html文件么?还是想写xhtml?浏览器不知道xtml是什么当然不处理
      

  5.   

    唯一的可能就是
    window.location="/indexWeb.htm";这个有错
    改成window.location.href="/indexWeb.htm";看下
      

  6.   

    貌似浏览器都把未知扩展名文件当html尝试解析?那应该把第一行
    <%@ page contentType="text/html; charset=utf-8" %>
    删了吧,这是jsp的标签不是html的
      

  7.   

    试下:
    1、window.location="${pageContext.request.contextPath }/indexWeb.htm";
    2、<jsp:forward page="indexWeb.htm"></jsp:forward>