jsp页面导出excel 并且可以弹出保存对话框
主要在jsp页面加入
<%@ page contentType="application/msexcel;charset=GBK"%>
<%
response.setHeader("Content-disposition",
"attachment; filename=shouExcel.xls");
%>
完整页面如下:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ page contentType="application/msexcel;charset=GBK"%>
<%
response.setHeader("Content-disposition",
"attachment; filename=shouExcel.xls");
%>
<html>
<head>
<title>导出</title>
</head>
<body>
<table width="100%" border="1" cellpadding="1" cellspacing="1">
<tr>
<td height="22">
<div align="center">
<strong>设备名称</strong>
</div>
</td>
<td height="22">
<div align="center">
<strong>错误类型</strong>
</div>
</td>
<td height="22">
<div align="center">
<strong>次数</strong>
</div>
</td>
<td>
<div align="center">
<strong>时间</strong>
 
相关文档:
1.request对象
客户端的请求信息被封装在request对象中,通过它才能了解到客户的需求,然后做出响应。它是HttpServletRequest类的实例。
序号 方 法 说 明
1 object getAttribute(String name) 返回指定属性的属性值
2 Enumeration getAttributeNames() 返回所有可用属性名的枚举
3 String getCharacterEncoding( ......
jQuery是目前一个很流行的js框架,它也提供了对ajax很好的支持。使用ajax异步请求数据时,如果服务器返回的一个列表数据,通常的做法是把列表数据转换成json格式的数据,然后返回到页面,使用jQuery进行解析并用表格来显示,这要求你对javascript解析json很熟透。
我在这里提供一种投机取巧的做法,使用jQuery发送异步请求 ......
jsp中文显示乱码解决方案2006-12-27 22:56
一、JSP页面显示乱码
二、表单提交中文时出现乱码
三、数据库连接
大家在JSP的开发过程中,经常出现中文乱码的问题,可能一至困扰着您,我现在把我在JSP开发中遇到
的中文乱码的问题及解决办法写出来供大家参考。
一、JSP页面显示乱码
下面的显示页面(display.jsp)就出现乱 ......
在提交表单的页里加上
<%
org.apache.struts.util.TokenProcessor.getInstance().saveToken(request);
%>
<input type="hidden" name="org.apache.struts.taglib.html.TOKEN" value="<%=session.getAttribute("org.apache.struts.action.TOKEN")%>" />
struts action里
if(isTokenValid(request ......