怎样把jsp页面上的内容导入到word或excel中??但不降低客户端安全级别!

stoney0914 2004-11-29 04:46:33
怎样把jsp页面上的内容导入到word或excel中??但不降低客户端安全级别!
...全文
195 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
JK_10000 2004-11-29
  • 打赏
  • 举报
回复
如果传进一个exportType=excel的request,
就导成excel:
否则,就以页面的形式显示

<%@ page errorPage="ErrorPage.jsp" %>

<%
String exportType=request.getParameter("exportType");
if("excel".equals(exportType)){
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment;filename=yourFileName.xls");
}


%>
<html>
<head>
<title>Contempo</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

</head>
<body >
<table width="100%" border=1>
<tr>
<td >dd</td>
</tr>
<tr>
<td>ddd</td>
</tr>
</table>


</body>
</html>
JK_10000 2004-11-29
  • 打赏
  • 举报
回复
<%@ page errorPage="ErrorPage.jsp" %>

<%
String exportType=request.getParameter("exportType");
if("excel".equals(exportType)){
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment;filename=yourFileName.xls");
}


%>
<html>
<head>
<title>Contempo</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="<%=Config.getHomeURL()%>/css/standardCSS.css">

</head>
<body leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="5">
<table width="100%" border=1>
<tr>
<td >dd</td>
</tr>
<tr>
<td>ddd</td>
</tr>
</table>


</body>
</html>

87,994

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧