<%@page import="com.tanzhou.dao.StudentDao"%><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ page import="java.util.*" %><%@ page import="com.tanzhou.dao.StudentDao" %> <!-- 导入StudentDao.java --><%@ page import="com.tanzhou.util.ExcelUtil" %> <%@ taglib prefix="c" uri="https://java.sun.com/jsp/jstl/core" %> <%-- <%@ taglib prefix="c" uri="/WEB-INF/lib/c.tld" %> --%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>导出excel</title></head><body><% List<HashMap<String,Object>> students = StudentDao.findStudents(); //pageContext.setAttribute("students", students); //绑定到页面上下文中去 String path = request.getRealPath("/")+"student.xls"; ExcelUtil.exportData(students, path); out.println("<a href='/ExportExcel/student.xls'>下载</a>"); %></body></html>
添加回答
举报
0/150
提交
取消