有一个框架的网页,框架中name=main的网页实现文件下载pubfiles.jsp,
下载的按钮用隐藏表单的方式提交download.jsp,会弹出文件下载的对话框。
可是等文件下载后,框架中name=right的网页链接点击没任何反映,
不会在name=main的网页中显示,要刷新pubfiles.jsp网页才能恢复
请问:文件下载的对话框关闭后,怎么自动工刷新pubfiles.jsp
或者不刷新pubfiles.jsp,怎样使框架中name=right的网页链接点击能在name=main网页中显示
download.jsp文件内容如下:(实现文件下载)
<html><head>
<%@page contentType="text/html; charset=gb2312" language="java" %>
<%@page import="java.util.*"%>
<%@page import="java.io.*"%>
<%@page import="java.net.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"></head><body> 
<%
  String us_id=(String)session.getAttribute("us_id");
  if(us_id==null){
  %>
   <script  language=javascript> 
    alert("您还没登录或登录超时!");
    top.location.href = "../index.jsp"
    </script><%
  }
  else{
  String path="d:\\pub\\";
  String fileName="";
    if (request.getParameter("file") != null) {
        fileName =(String)request.getParameter("file");
        path =path+(String)request.getParameter("path")+"\\";
    }
 /*
 if("1".equals(request.getParameter("downloadFlag"))){//downloadFlag为1时为下载文件
   response.setHeader("Content-disposition","attachment; filename="+fileName);
   response.setContentType("application/ms-word");
    }else if("0".equals(request.getParameter("downloadFlag"))){//downloadFlag为0时为用指定的程序打开文件
   response.setContentType("application/ms-word");
 }//downloadFlag为其他值时用IE默认的方式打开文件
 */
   response.setHeader("Content-disposition","attachment; filename="+new String(fileName.getBytes("gb2312"),"iso8859-1"));
    response.setContentType("application/ms-word");
    //response.setContentType("application/x-msdownload");
    BufferedInputStream bis = null;
    BufferedOutputStream bos = null;
    try {
        bis = new BufferedInputStream(new FileInputStream(new File(path + fileName)));
        bos = new BufferedOutputStream(response.getOutputStream());        byte[] buff = new byte[2048];
        int bytesRead;
        while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
            bos.write(buff,0,bytesRead);
        }    } catch(final IOException e) {
        System.out.println ( "IOException." + e );
        if (bis != null)
            bis.close();
        if (bos != null)
            bos.close();
    } finally {
        if (bis != null)
            bis.close();
        if (bos != null)
            bos.close();
    }
        if (bis != null)
            bis.close();
        if (bos != null)
            bos.close();   }
   
%></body></html>

解决方案 »

  1.   

    不是很明白你的意思,我又没有做过文件下载的东西,不过知道子窗口关闭的时候父窗口是可以响应事件的,还有你只提交download.jsp,不知道你这个jsp在那个页面里面。?
      

  2.   

    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.*" import="java.sql.*" errorPage="" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html><head>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>文件名</title>
    </head><body> 
    <jsp:useBean id="FTPClient" scope="page" class="mhxhoa.FTPClient"/>
    <jsp:useBean id="DbConnection" scope="application" class="mhxhoa.DbConnection"/>
    <jsp:useBean id="StringDetach" scope="application" class="mhxhoa.StringDetach"/><%
    //不使用缓存
    response.setHeader("Pragma", "No-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0);
    //
      String us_id=(String)session.getAttribute("us_id");
      if(us_id==null){
      %>
       <script  language=javascript> 
        alert("您还没登录或登录超时!");
        top.location.href = "../index.jsp"
        </script>
     <%
      }
      else{
      String f1_node=(String)request.getParameter("f1_node");
      Statement stmt=DbConnection.getStatement();
      ResultSet rs =stmt.executeQuery("select f1_jname from fu1_node where f1_node='"+f1_node+"'");
      rs.next();
      String jname=rs.getString(1).trim();
      FTPClient.init("user","passwd","127.0.0.1",21);
      FTPClient.cd("\\"+jname);
      Vector v=FTPClient.getFilelist();
     %>
    <p align="center"> </p>
    <p align="center"><%=jname%>文件清单</p>
    <div align="center"><table border="0" width="697">
    <tr>
    <td width="404" bgcolor="#C0C0C0">
    <p align="center">文件名</td>
    <td width="90" bgcolor="#C0C0C0">
    <p align="center">文件大小</td>
    <td width="136" bgcolor="#C0C0C0">
    <p align="center">上传时间</td>
    <td width="49" bgcolor="#C0C0C0">
    <p align="center">下载</td>
    </tr>
    <tr>
    <%
      for(int i=0;i<v.size();i++){
       String s=(String)v.elementAt(i);
       StringDetach.setString(s," ");
    %><form method="POST" action="download.jsp" >
    <td width="404" height="22" bgcolor="#CCFFCC">
    <input type=hidden name="file" value="<%=s.substring(s.indexOf(":")+4)%>">  
    <input type=hidden name="path" value="<%=jname%>">  
    <p align="left"><%=s.substring(s.indexOf(":")+4)%></td>
    <td width="90" height="22" bgcolor="#CCFFCC">
    <p align="center"><%=StringDetach.getString(1)%>k</td>
    <td width="136" height="22" bgcolor="#CCFFCC">
    <p align="center"><%=StringDetach.getString(2)+" "+StringDetach.getString(3)%></td>
    <td width="49" height="22" bgcolor="#CCFFCC">
    <p align="center" style="margin-top: 0; margin-bottom: 0">
    <input type="submit" value="下载" name="B3"></p>

    </td></form>
    </tr>
    <%
    }
    %>
    </table>
    </div>
    <%}%>
    </body></html>
      

  3.   

    上面是pubfiles.jsp文件内容,拜托了!!!!!!!!!!!!!!!1111搞了几天了,真是郁闷