response.reset() 与response.resetbuffer使用场景
来源:互联网 发布:win10蓝牙 浏览软件 编辑:程序博客网 时间:2024/06/06 18:55
getResponse的getWriter()方法
getResponse的getWriter()方法连续两次输出流到页面的时候,第二次的流会包括第一次的流,所以可以使用response.reset或者resetBuffer的方法。
reset():
Clears any data that exists in the buffer as well as the status code and headers. If the response has been committed, this method throws an IllegalStateException.
response.reset()的使用有一个条件受限:response的任何打开流关闭之后都不能再reset .
resetBuffer():
Clears the content of the underlying buffer in the response without clearing headers or status code. If the response has been committed, this method throws an
IllegalStateException.
可以看到resetBuffer方法与reset方法的区别是,头和状态码没有清除。
一般用于下载文件excel操作时:
一般用于下载文件excel操作时:
空白行的出现原因,jsp代码编译后产生。就是有jsp生成html文件的时候,html文件内部会出现很多空白行。下载后的文件内的空白行也是这样产生的。 因此,需要 response.reset() 来清除首部的空白行。
阅读全文
0 0
- response.reset() 与response.resetbuffer使用场景
- response.reset() 与response.resetbuffer使用场景
- response.reset & resetBuffer
- response.reset()
- Response.Write("...")与 Response.Redirect("...")不能同时使用
- asp.net中Response.write与Response.Redirect同时使用
- Response
- response
- response
- response
- Response
- response
- response
- response
- response
- response
- response
- @Response
- 第八周项目三(1)—顺序串算法之将字符串S中所有值为c1的字符换成值为c2的字符
- std bind相关
- 标注问题及评价
- 第八周项目2---建立链串的算法库
- R-FCN:Region-based fully convolutional networks
- response.reset() 与response.resetbuffer使用场景
- 欢迎使用CSDN-markdown编辑器
- LeetCode-290-Word Pattern
- mongodb 分片与副本集
- html a标签打电话,发短信等。
- 第八周项目2-顺序串算法(2)
- 移植到64位应用程序出现0xc00007b的解决办法
- CXF:java.lang.AbstractMethodError:org.apache.xerces.dom.ElementNSImpl.setUserData
- Spring中AOP详解