(转)ssh jxl导出Excel时报错:getOutputStream() has already been called for this response

java.lang.IllegalStateException:   getOutputStream()   has   already   been   called   for   this   response  

原因:

因为页面出现了多个输出流所至,在多个<%//使用了outputStream   %>语句之间不能有空格及多余的字符。也就是页面中<%//使用了outputStream   %>之外不能有空格或其它任何字符。在之内的语句可以有空格及回车。也就是说如果你的JSP页面本来就有了一个输出流,但是由于你在其中又重新定义了一个输出流,服务器就会报错!

 

解决方法:

os.flush();

参见servlet API中的getOutputStream()方法的使用说明。

猜你喜欢

转载自zhizhi555555.iteye.com/blog/2104054