偶的代码是
response.setContentType("image/gif"); 
ServletOutputStream sout = response.getOutputStream(); 
int len; 
byte buf[]=new byte[1024]; 
while ((len=in.read(buf,0,1024))!=-1) { 
sout.write(buf,0,len); 
但是ServletOutputStream sout = response.getOutputStream(); 
有问题:getWriter() has already been called for this response
不知道,用JAVA怎么解决~~~~~~~,不用Servlet,可以吗~~~~~~

解决方案 »

  1.   

    已经对jsp页面中的内置对象response进行过getWriter的调用,所以用户代码再次调用getOutputStream的时候就会抛出IllegalStateException
      

  2.   

    jdk api:
    getOutputStream
    public ServletOutputStream getOutputStream()
    .....
    Returns:
    ....
    Throws: 
    IllegalStateException - if the getWriter method has been called on this response 
    IOException - if an input or output exception occurred