- 浏览: 62810 次
- 性别:
- 来自: 广州
文章分类
最新评论
今天写验证码的时候,遇到了这个问题:java.lang.IllegalStateException: getOutputStream() has already been called for this response 上网找到了以下知识,我只试了第二种方法确实好使!粘来供大家参考: getOutputStream() has already been called for this response问题的解决 原因一: ServletResponse的getWriter()方法里会抛出这个异常, IllegalStateException - if the getOutputStream method has already been called 而它的getOutputStream()方法里会抛出这个异常. IllegalStateException - if the getOutputStream method has already been called for this response object 并且两者的函数申明里都有这么样的一句
(4361578 ms) [http-8080-Processor25] ERROR: org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/xixibar].[jsp]#invoke : Servlet.service() for servlet jsp threw exception
在tomcat5下jsp中出现此错误一般都是在jsp中使用了输出流(如输出图片验证码,文件下载等), 然后当然是要提出解决的办法,其实挺简单的(并不是和某些朋友说的那样-- 在使用完输出流以后调用以下两行代码即可: |
发表评论
-
java泛型
2015-08-30 18:04 408一. 泛型概念的提出(为什么需要泛型)? 首先,我们看下下 ... -
综合getOutputStream() has already been called for this response 出错示例
2011-09-03 00:58 2076AJAX验证jsp页面验证码 在做登录的时候往往会加上 ... -
判断是否为素数
2011-08-19 22:39 937package ch15; public class Pri ... -
tomcat认识
2011-07-19 11:29 689tomcat的组件结构2007-05-23 ... -
看了这篇文章之后收益挺大的
2011-04-27 19:44 695介绍Java学习的一些主线 ... -
再次熟记
2011-04-19 14:14 472数据类型 1、基本数据类型 数值型 ... -
课后练习01
2011-04-15 16:25 8531、对于许多数据结构来说,可以(插入)一条记录,可以(查找), ... -
word不能直接打开老是出现安全模式是什么原因?
2011-04-06 16:07 1575故障现象:今天在打开一个word文件时出错,重新启动word出 ... -
小练日期处理方法_DAO
2011-03-24 20:41 623package com.jianson.DATE; impo ... -
java中的简单日期处理
2011-03-23 10:36 575public class TestDate { publi ... -
stament接口的三个方法:execute、executeupdate、executeuquery
2011-03-17 20:00 1306execute、executeQuery和executeUpd ... -
可投放广告位的博客
2011-03-14 11:45 7791.站点名称: Google自己的博客站占地址: http:/ ... -
application试题
2011-01-28 13:50 550—————O(∩_∩)O ... -
application实现简单的网页计数器--02
2011-01-28 13:17 837————————app ... -
application实现简单的网页计数器--01
2011-01-28 00:05 1709—— ———————————— index.jsp页面 ... -
JDK、SDK、JRE、JVM—初识02
2011-01-25 12:07 732(出自:http://freesea. ... -
JDK、SDK、JRE、JVM—初识01
2011-01-25 11:52 806JDK、SDK、JRE、JVM概念的理解是什么呢?我们 ... -
环境变量的设置
2010-11-09 18:03 726今天在笔记本上准备使 ...
相关推荐
NULL 博文链接:https://javal.iteye.com/blog/1993903
1.在tomcat6.0下jsp出现getOutputStream() has already been called for this response异常的原因和解决方法 在tomcat6.0下jsp中出现此错误一般都是在jsp中使用了输出流(如输出图片验证码,文件下载等),没有...
纠结了半天的 java.lang.IllegalStateException: getOutputStream() has already。这个问题困扰了半天,在网上查阅了大量资料 出这个错误一般就是下面2个.....
验证码出现getOutputStream() has already been called for this response错误解决
解决了getOutputStream() has already been called for this response. 并将产生验证码的逻辑从JSP页面中分离出来,单独写了一个类 便于重用。
NULL 博文链接:https://nethub2.iteye.com/blog/2023937
servlet的response可以对返回的内容和格式进行一些设置。
Returns a boolean indicating whether the named response header has already been set. contextDestroyed(ServletContextEvent) - Method in interface javax.servlet.ServletContextListener Notification ...
* This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server ...
随机获取验证码 public class CheckNumberServlet extends HttpServlet { ... ServletOutputStream sos = response.getOutputStream();…………………………………………………………………………………………
public void code(HttpServletRequest request, HttpServletResponse response) throws IOException{ String[] tableNames = new String[]{};... IOUtils.write(data, response.getOutputStream()); }
heads是excel表头,datalist是数据public void createExcelStream(HttpServletResponse response,String filename,String[] heads,List[]> datalist){ try{ OutputStream os = response.getOutputStream();...
getWriter() 和Response.getOutputStream冲突
import java.io.*; import java.util.*; import javax.servlet.*; ... public class MyServlet ... OutputStream out_Stream = response.getOutputStream(); out_Stream.write( data ); out_Stream.close(); } }
OutputStream outs = response.getOutputStream();// 获取文件输出IO流 BufferedOutputStream bouts = new BufferedOutputStream(outs); response.setContentType("application/x-download");// 设置response...
用与java web 开发,java 实现的数字验证码的生成 class Image{} *" %> //设置页面不缓存 response.setHeader("Pragma","No-cache");...ImageIO.write(image.creatImage(), "JPEG", response.getOutputStream()); %>
在table中导出Excel详细过程OutputStream os = response.getOutputStream(); response.setContentType("application/msexcel"); response.setHeader("Content-disposition","attachment; filename=clerkAddress.xls...
VC6.0 实现jpeg图像的读取
简单的验证码实现 public static void ... ServletOutputStream out = response.getOutputStream(); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); encoder.encode(image); out.close(); }