日期:2014-05-17  浏览次数:20704 次

打开页面后刷新图片不成功!很纠结啊
a.jsp和b.jsp 实现在a.jsp中点击弹出b.jsp,并在弹出前生成图片,每次生成的图片不同。

<%@ page language="java" pageEncoding="gbk"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

<meta http-equiv="content-type" content="text/html; charset=gbk"/>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>交易行为占比统计报表</title>
<link rel="stylesheet" href="../resource/css/css.css">
<script language="javascript" src="../resource/js/jquery-1.2.6.js"></script>
<script type="text/javascript">
function showImg(){
var tag=document.getElementById("tagDiv");
tag.innerHTML="";
tag.innerHTML="<img src='../resource/reportImages/jiaoyixingwei_pie.jpeg' border='0px' />";

}
function showImg2(){
$("#tagDiv").empty();
$("#tagDiv").append("<img src='../resource/reportImages/jiaoyixingwei_pie.jpeg' border='0px' />");
}
function showImg3(){
$("#tagImg").attr("src","");
$("#tagImg").attr("src","../resource/reportImages/jiaoyixingwei_pie.jpeg");
}
</script>
</head>
<body onload="showImg3()">
<div id="main">

<div id="tagDiv" style="width:100%;">
<img id="tagImg" src='../resource/reportImages/jiaoyixingwei_pie.jpeg' border='0px' />
</div>
</div>
</body></html>

 我用上面的三种方法都试过了,服务器端的图片已经改变,但是b.jsp中显示的图片总是为第一次弹出的图片,缓存我也消除了,还会是什么原因呢???

------解决方案--------------------
<img src='../resource/reportImages/jiaoyixingwei_pie.jpeg?t='+new Date().getTime() border='0px' />试试呢
------解决方案--------------------
介个应该是浏览器缓存的问题~
禁了缓存试试~