我的代码是这样的:---------index.jsp<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
<script type="text/javascript">
document.getElementById("if").width =screen.availWidth;
</script>
  </head>
  
  <body>
  <center>
   <iframe id="if" frameborder="0" src="<%=basePath %>mainVisual/mainFrame.jsp"></iframe>
  </center>
  </body>
</html>
然后这是mainFrame.jsp
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <style type="text/css">
   </style>
  </head>
  <frameset rows="15%,*" frameborder="no" border="0">
   <frame scrolling="no" src="<%=basePath %>mainVisual/top.jsp" noresize="noresize"/>
   <frame src="<%=basePath %>mainVisual/mainForm/mf_Frame.jsp"/>
  </frameset>
</html>然后是top.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  </head>
  
  <body>
   <img alt="欢迎来到W3copy" src="<%=basePath%>W3Images/toplogo.jpg">
  </body>
</html>----------------------分割线---------------------
当我直接写上http://localhost:8080/W3copy/mainVisual/mainFrame.jsp时,
能否正常输出图片!但是,当我http://localhost:8080/W3copy/是,图片好像被压缩了一样,只显示一点点。请问,这是怎么回事,该怎么解决呢 ?

注:
1、我的web.xml默认了index.html:<welcome-file>index.jsp</welcome-file>
2、希望回答者能够用代码交流,这样更易理解!谢谢

解决方案 »

  1.   


    我猜测问题出在iframe,所以我试图再javascript里面给iframe设置全屏大小,可是怎么设我不会,上面自己写的那个也不知道有没有错!
      

  2.   


    我猜测问题出在iframe,所以我试图再javascript里面给iframe设置全屏大小,可是怎么设我不会,上面自己写的那个也不知道有没有错!自己在顶一下
      

  3.   

    ceshi1.html<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <center>
              <iframe src="ceshi2.html" width="100%" height="400" scrolling="no" frameborder="0"></iframe>
        </center>
    </body>
    </html>ceshi2.html<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
     <frameset rows="15%,*" cols="*">
          <frame scrolling="no" src="ceshi3.html" noresize="noresize"/>
          <frame src="ceshi4.html"/>
      </frameset>
    </html>ceshi3.html<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <img alt="欢迎来到W3copy" src="2012.jpg">
    </body>
    </html>ceshi4.html<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    下方显示
    </body>
    </html>
      

  4.   

    图片都写成绝对路径试下 <img alt="欢迎来到W3copy" src="/W3Images/..">