各位好,我在jsp页与servlet中都使用了smartupload来下载文件,共同的问题是,下载完毕后,无论是使用javascript还是reponse.forword无法跳转,请高手帮助,解决即散分。

解决方案 »

  1.   

    还有这种事情,你能构println出内容么,如果可以,那就可以使用javascript
      

  2.   

    out.print("<script language='javascript'>\n");
    out.print("alert('你的信息!');\n");
    out.print("window.document.location.href='index.jsp';\n");
    out.print("</script>\n");
      

  3.   

    感谢 stefli() 与 qdian(用心去流浪) 两位老兄的指点,试了一下,仍然是不行
    另:在IE5下正常,IE6下有问题
      

  4.   

    package qp;import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.net.URLEncoder;
    import com.jspsmart.upload.*;
    import java.util.*;public class toolsdown extends HttpServlet {
      private static final String CONTENT_TYPE = "text/html; charset=GBK";
      //Initialize global variables
      public void init() throws ServletException {
      }
      //Process the HTTP Get request
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       doPost(request, response);
      }
      //Process the HTTP Post request
      public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType(CONTENT_TYPE);
        try
          {
              SmartUpload su = new SmartUpload();
              su.initialize(getServletConfig(),request,response);
              su.setContentDisposition(null);
              String fileName = request.getParameter("fileName");
              fileName = new String(fileName.getBytes("8859_1"), "gb2312");
              String path = request.getParameter("downPath");
              String filepath = path+fileName;
              su.downloadFile(filepath);
          }
          catch ( Exception e )
          {
          }
      }
      //Clean up resources
      public void destroy() {
      }
    }
      

  5.   

    多谢 qdian(用心去流浪) 老兄费心指点