JSP 에서 Excel 표 의 인 스 턴 스 를 내 보 냅 니 다.
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition","attachment;filename=" + URLEncoder.encode(" .xls", "UTF-8"));
이 두 줄 을 JSP 에 넣 을 수도 있어 요.jsp 코드 는 다음 과 같 습 니 다:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition","attachment;filename=" + java.net.URLEncoder.encode(" .xls", "UTF-8"));
%>
<!DOCTYPE html>
<html>
<head>
<title>CMS- </title>
<meta charset="utf-8" />
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
</head>
<body>
<table id="sample-table-1" border="1" cellpadding="2" cellspacing="1">
<thead>
<tr>
<th nowrap width="15%"> </th>
<th nowrap width="5%"> </th>
<th nowrap width="5%"> </th>
<th nowrap width="5%"> </th>
</tr>
</thead>
<tbody>
<c:forEach items="${list}" var="model" varStatus="status" >
<tr>
<td>${model.id}</td>
<td>${model.cardNo}</td>
<td>${model.name}</td>
<td>${model.age}</td>
</tr>
</c:forEach>
</tbody>
</table>
</body>
</html>
이상 의 JSP 에서 엑셀 표를 내 보 낸 실례 는 바로 편집장 이 여러분 에 게 공유 한 모든 내용 입 니 다.여러분 에 게 참고 가 되 고 여러분 들 이 저 희 를 많이 지지 해 주시 기 바 랍 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
JSP| EL (Experession Language)텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.