---
title: "response的reset和resetBuffer"
author: "androider"
date: "2007-11-29T20:13:43Z"
tags: []
slug: "response-reset-resetbuffer"
draft: false
lastmod: "2007-11-29T20:13:43Z"
id: 144928
url: "https://androider.iteye.com/blog/144928"
---

使用struts2的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.

resetBuffer():
Clears the content of the underlying buffer in the response <span style="color:red">without clearing headers or status code</span>. If the response has been committed, this method throws an IllegalStateException.