js端table转csv
index.jsp
function getCSVData(){
//tablesorter就是要导出的table
var csv_value=$(‘#tablesorter‘).table2CSV({delivery:‘value‘});
//$("#download_schedule").attr("href","./download_schedule.jsp?csv_value=‘"+csv_value+"‘");
$("#csv_text").val(csv_value);
}
<form action="download_schedule.jsp" method ="post" target="_blank">
<input type="hidden" name="csv_text" id="csv_text">
<input type="submit" value="csv出力" /></td>
</form>
download_schedule.jsp
<%@ page language="java" import="java.util.*,java.lang.*" pageEncoding="shift_jis"%>
<%
response.setHeader("Content-type","application/octet-stream;charset=shift_jis");
response.setHeader("Content-Disposition","attachment; filename=\"work table.csv\"");
String value = request.getParameter("csv_text");
out.println(value);
%>
table2csv.js下载链接
http://download.csdn.net/detail/le5le/8385143
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。