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

Ex) eq (==)

1. <c:if test="${ null eq test_column }"> // null

2. <c:if test="${ 0 eq test_column }"> // 숫자

3. <c:if test="${ '0' eq test_column }"> // 문자

 

Ex) empty

= <c:if test="${ empty test_columnMap }"> // list, map 객체 등

= <c:if test="${ !empty test_columnMap }"> // 비어 있지 않은 경우

 

Ex) ne (!=)

1. <c:if test="${ null ne test_column }"> // null

2. <c:if test="${ 0 ne test_column }"> // 숫자

3. <c:if test="${ '0' ne test_column }"> // 문자

'JSP' 카테고리의 다른 글

JSP에서 엑셀 다운로드 기능 구현  (0) 2019.11.19

+ Recent posts