jsp에서는 xlsx 는 지원 안됨.

<!-------------------------------------------- MS - WORD -------------------------------------------->
<%@ page language="java" contentType="application/vnd.ms-excel;charset=utf-8" pageEncoding="utf-8"%>
 
    response.setHeader("Content-Disposition", "attachment; filename=test.xls"); 
    response.setHeader("Content-Description", "JSP Generated Data");
 
    // 저장 여부 묻지 않고 바로 저장
    response.setContentType("application/vnd.ms-excel");
 
 
<!-------------------------------------------- MS - EXCEL -------------------------------------------->
<%@ page language="java" contentType="application/vnd.word;charset=utf-8" pageEncoding="utf-8"%>
 
    response.setHeader("Content-Disposition", "attachment; filename=test.doc"); 
    response.setHeader("Content-Description", "JSP Generated Data");
 
    // 저장 여부 묻지 않고 바로 저장
    response.setContentType("application/vnd.ms-word");
 
 
<!-------------------------------------------- 한글 -------------------------------------------->
<%@ page language="java" contentType="application/hwp;charset=utf-8" pageEncoding="utf-8"%>
 
    response.setHeader("Content-Disposition", "attachment; filename=test.hwp"); 
    response.setHeader("Content-Description", "JSP Generated Data");
 
    // 저장 여부 묻지 않고 바로 저장
    response.setContentType("application/hwp");

 

'JSP' 카테고리의 다른 글

JSTL 의 eq , empty , ne 명령  (0) 2019.11.13

+ Recent posts