Java 구현 파일 클릭 비반응 방법

jsp 페이지 링크, 액세스 액션을 누르면 IO로 서버에 있는 파일을 다운로드합니다. 문제는 아무리 눌러도 반응이 없고 로그도 틀리지 않습니다.
프론트 데스크 aax 코드

Ext.Ajax.request({
url : '/yjy/training/TrainingTimeAction.do?method=downLoadAttchById',
params : {
timeId : timeids
},
success : function(response,options){
var result = Ext.util.JSON.decode(response.responseText);
Ext.Msg.alert(" ");
},
failure :function(response,options){
var result = Ext.util.JSON.decode(response.responseText);
Ext.Msg.alert(" "+result.message);
}
});
백그라운드 액션 코드

String timeId = request.getParameter("timeId");
      String sql = "select doc_name from CPER.EHRTRAIN_item_DOCUMENT where item_id = ?";
      DbHelper dbHelper = new DbHelper();
      Object[] params = new Object[]{timeId};
      String fileName = (String)dbHelper.runSQLScalar(sql, params);
      String filePath = ServerPathUtil.getPathRoot()+"WEB-INF/cache/train_item_file/train_item_file_"+timeId+"/"+fileName;
      File file = new File(filePath);
      if(!file.exists()){
        logger.debug(" ");
        throw new IOException("the file not exists");
      }
      response.setContentLength((int) file.length());
      OutputStream o = response.getOutputStream();
      byte b[] = new byte[5000];
      //response.setContentType("application/x-msdownload");
      response.setContentType("application/vnd.ms-excel");
      response.setContentLength((int)file.length());
      response.setHeader("Content-Disposition","attachment; filename="+fileName);
      FileInputStream in = new FileInputStream(file);
      int n; 
      while ((n = in.read(b)) != -1) {
        o.write(b, 0, n);
      }
      in.close();
    }catch(Exception e){
      e.printStackTrace();
    }
해결 방법: 파일의 다운로드는 프론트에서 요청할 때form 폼 요청이나 윈도우로만 가능합니다.오픈의 방식, 마지막으로 나는 윈도우를 채택했다.오픈 방식

window.open('/yjy/training/TrainingTimeAction.do?method=downLoadAttchById&timeId=' + timeids);
주: 이 방식을 사용하면 페이지에 공백 창이 뜨고 다운로드하면 창이 자동으로 닫힙니다. 이 창을 표시하지 않으려면form으로 제출하십시오
총결산
위에서 말한 것은 여러분이 소개한 자바 구현 파일 클릭이 반응하지 않는 방법입니다. 여러분께 도움이 되었으면 합니다. 만약에 궁금한 것이 있으면 저에게 메시지를 남겨 주십시오. 편집자는 제때에 답장을 드리겠습니다.여기에서도 저희 사이트에 대한 지지에 감사드립니다!

좋은 웹페이지 즐겨찾기