当前位置: 代码迷 >> Java Web开发 >> iframe不显示图片有关问题
  详细解决方案

iframe不显示图片有关问题

热度:2915   发布时间:2016-04-11 00:09:24.0
iframe不显示图片问题
我的代码是这样的:

---------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/是,图片好像被压缩了一样,只显示一点点。
  相关解决方案