ResponseUtil
package util; import java.io.OutputStream;
import java.io.PrintWriter; import javax.servlet.http.HttpServletResponse; import org.apache.poi.ss.usermodel.Workbook; public class ResponseUtil { public static void write(HttpServletResponse response,Object o) throws Exception{
response.setContentType("text/html;charset=utf-8");
PrintWriter out = response.getWriter();
out.println(o.toString());
out.flush();
out.close();
} public static void export(HttpServletResponse response,Workbook wb,String fileName)throws Exception{
response.setHeader("Content-Disposition", "attachment;filename="+new String(fileName.getBytes("utf-8"),"iso8859-1"));
response.setContentType("application/ynd.ms-excel;charset=UTF-8");
OutputStream out=response.getOutputStream();
wb.write(out);
out.flush();
out.close();
}
}
ResponseUtil的更多相关文章
- ResponseUtil反射制造唯一结果
调用:通过反射调用同一个类型的返回值 return fillResponse(response,Constants.SUCCESS,"获取数据成功","taskList& ...
- ResponseUtil数据传递至前端
package com.java1234.util; import java.io.OutputStream; import java.io.PrintWriter; import javax.ser ...
- java分页三个类 PageBean ResponseUtil StringUtil
package ssmy.page; /** * 分页类 * @author Jesse * */public class PageBean { private int page;//第几页 priv ...
- 利用Spring的@Async异步处理改善web应用中耗时操作的用户体验
Web应用中,有时会遇到一些耗时很长的操作(比如:在后台生成100张报表再呈现,或 从ftp下载若干文件,综合处理后再返回给页面下载),用户在网页上点完按钮后,通常会遇到二个问题:页面超时.看不到处理 ...
- velocity模板引擎学习(3)-异常处理
按上回继续,前面写过一篇Spring MVC下的异常处理.及Spring MVC下的ajax异常处理,今天看下换成velocity模板引擎后,如何处理异常页面: 一.404错误.500错误 <e ...
- MyBatis+springMVC+easyUI (dataGirl)实现分页
页面展示效果. 页面代码: <%@ page contentType="text/html;charset=UTF-8" language="java" ...
- springMvc(三)session、HandlerInterceptorAdapter
仅供参考 设置session值,根据自己的需求设置值 /** * 登入验证 * * @return */ @RequestMapping(value = "/loginCheck.htm&q ...
- java springmvc Log4j filter等(稍微完善一下项目)
仅供参考-接上文 springmvc 1.设置Log4jConfigListener日志监听(可以为开发调试.发布后运行的意外调试.等) 在src/main/resources目录下新建log4j. ...
- hibernate分页实现
1.创建分页实体类 public class PageBean { private int page; // 页码 private int rows; // 每页显示行数 private int st ...
随机推荐
- 【scala】数组和列表
一.数组Array 1.创建数组 隐式:val greetStrings = new Array[String](3); 显式:val greetStrings : Array[String] = n ...
- VMware虚拟机克隆Linux系统引起的网卡问题
1. 手动配置静态网卡地址不生效2. 网卡名变成了eth1[root@localhost network-scripts]# ls |grep ifcfg ifcfg-eth0 ifcfg-lo [r ...
- WebForms UnobtrusiveValidationMode 需要“jQuery”ScriptResourceMapping。
.net framework4.5开发中, Unobtrusive ValidationMode是一种隐式的验证方式,需要前端调用jquery来进行身份验证.且默认启用. 解决方法如下 方法一: 修改 ...
- How to handle your webdriver exceptions
The most common exceptions and their solutions: NoAlertPresentException Indicates that a user has tr ...
- lzugis——Arcgis Server for JavaScript API之自定义InfoWindow
各位看到这个标题不要嫌烦,因为本人最近一直在研究相关的问题,所以相关文章也只能是这些,同时希望看过我的文章的朋友,我的文章能够给你帮助. 在前面的两篇相关的文章里面,实现InfoWindow是通过di ...
- 谈谈Java基础数据类型
Java的基本数据类型 类型 意义 取值 boolean 布尔值 true或false byte 8位有符号整型 -128~127 short 16位有符号整型 -pow(2,15)~pow(2,15 ...
- OpenCV中阈值(threshold)函数: threshold 。
OpenCV中提供了阈值(threshold)函数: threshold . 这个函数有5种阈值化类型,在接下来的章节中将会具体介绍. 为了解释阈值分割的过程,我们来看一个简单有关像素灰度的图片,该图 ...
- HSRP/VRRP/GLBP
当网络足够大的时候,网络规划师要考虑的技光是网络本身的性能问题,冗余技术也是必不可少的. 常见的冗余网关技术有• 热备份路由协议(HSRP).• 虚拟路由器冗余协议(VRRP)• 网关负载均衡协议(G ...
- (十二)break,continue
class Break { //break,continue public static void main(String[] args) { //break for(int i =0;i<=5 ...
- (四)java基本语法
关键字 被java赋予了特殊意义的单词: class,new,private,protected,public,static,final,abstract,interface,this,super,I ...