把图片存到硬盘上,再jsp中显示  imgs/001.jpg
若联动用单独.js文件实现,而不用在jsp中写<script>...</scrip>实现,则没有问题

解决方案 »

  1.   

    那就是a.jsp提交后,b.jsp没有自动刷新的问题了?
      

  2.   

    代码摘录如下:
    <html>
    <head>
    <title>数据统计</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style type=text/css>
    td,p,li,input,select {font-size:12px;}
    </style>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
       function getCities(){
         document.reForm.radioIndex.value="everyServiceSum";
         document.reForm.areaIndex.value=document.myform.Province.selectedIndex;
         document.reForm.submit();
       }
       function getCities1(){  //另一个联动用,因为太长,所以下面没有写出来
         document.reForm.radioIndex.value="curveChart";
         document.reForm.areaIndex.value=document.myform.Province3.selectedIndex;
         document.reForm.submit();
       }
    //-->
    </script>
    <%
         String radioI=request.getParameter("radioIndex");
         String areaI=request.getParameter("areaIndex");
         if(radioI==null) radioI="everyServiceSum";
         if(areaI==null) areaI="0";
         String[][] tempCitys=(String[][])citys.get(Integer.parseInt(areaI));
       %>
    <%
    response.setHeader("Pragma","No-cache");//HTTP 1.1
    response.setHeader("Cache-Control","no-cache");//HTTP 1.0
    response.setHeader("Expires","0");//防止被proxy
    %>
    </head>
    <body background="../imgs/bg.jpg">
    <div align="center">
        <font><b>数 据 统 计&nbsp;&nbsp;&nbsp;</b></font><br>
        <img alt="" src="../imgs/line8.gif" width="100%" height="5"/>
       <form  name='myform' method="GET" action="display.jsp">
         <table>
           <tr>
             <td>
               <input type="radio" name="sort" value="everyServiceSum" <%if(radioI.equals("everyServiceSum")) out.print("checked");%>><font color="770077">某地业务数</font>-------------
             </td>
             <td>
               <select name='Province' onchange="getCities();">
                 <%
                   for(int i=0;i<areaNum;i++)      //此处所需数据事先已经计算出来了
                   {
                     out.print("<option value='");
                     out.print(provinceNames[i]+"'");
                     String iStr=Integer.toString(i);
                     if(areaI.equals(iStr)) out.print(" selected");
                     out.println(">"+provinceNames[i]+"</option>");
                   }
                 %>
                </select>            <select name='city'>
                 <option value='all' selected >==全地区==</option>
                 <%
                   if(tempCitys.length!=1)
                   {
                     for(int i=0;i<tempCitys.length;i++)
                     {
                       out.print("<option value='");
                       out.print(tempCitys[i][0]+"'>"+tempCitys[i][0]+"</option>");
                     }
                   }
                 %>
                </select>
             </td>
           </tr>
     </table>
      <br>
      <input type="submit" name="commit" value="图形报表"  />   </form>
    <form name="reForm" action="userdata.jsp">
        <input type="hidden" name="radioIndex" value="everyServiceSum"/>
        <input type="hidden" name="areaIndex" value="0"/>
    </form>
    </body>
    </html>
      

  3.   

    对,是要在b.jsp显示的页面再点击一次刷新才显示正常
      

  4.   

    那怎样让它自动刷新?我在a.jsp,b.jsp中都加了下面代码还是不行,请高手指教。
    <% 
    response.setHeader("Pragma","No-cache");//HTTP 1.1
    response.setHeader("Cache-Control","no-cache");//HTTP 1.0
    response.setHeader("Expires","0");//防止被proxy
    %>
      

  5.   

    这样,你在处理完a.jsp提交的信息后在session中设定一个标记,表示是否需要刷新b.jsp,返回a.jsp时从session中取出这个标记进行判断,如是则刷新b.jsp
      

  6.   

    b.jsp从a.jsp中得到的“Province”等变量是最新的,不用刷新就显示出来了,但是图片要刷新一次才是最新的,事实上图片已经生成了,不知是什么原因?
    在b.jsp中加了 <meta http-equiv="Resfresh" content="1">也不顶事
      

  7.   

    <%
    response.setHeader("progma","no-cache");
    response.setHeader("Cache-Control","no-cache");
    response.setDateHeader("Expires",0);
    %>
      

  8.   

    根据以上各位的建议,做了以下修改:在进入a.jsp时把旧的图片先删除掉,再往下进行。可是问题依旧。服务器上已经没有旧的图片了,可是还能显示出来,看来是浏览器的缓存没有清空,请问如何清空呢?
    谢了!!
      

  9.   

    a.jsp中向b.jsp提供数据,b.jsp调用一个画图的javabean,并把图显示出来。检查一下是不是b.jsp调用javabean画图的时候出了问题或者javabean本身有问题!
    最好把bean代码贴出来!
      

  10.   

    bean太长了,我检查了目录下的图片,每次调用a.jsp会把旧图片删除,调用b.jsp会生成新图片,没有问题。