Re: getOutputStream() has already been called???
From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 03/13/04
- Next message: Matthew Macchia: "Re: implementing class files in different location for tomcat 4.1"
- Previous message: Max: "Re: Get Difference Between 2 images : very Slow"
- In reply to: Amy G: "Re: getOutputStream() has already been called???"
- Next in thread: Amy G: "Re: getOutputStream() has already been called???"
- Reply: Amy G: "Re: getOutputStream() has already been called???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 12 Mar 2004 18:40:08 -0600
"Amy G" <amy-g-art@cox.net> wrote in message
news:_lb4c.22362$BA.13710@fed1read03...
> "Ryan Stewart" <zzanNOtozz@gSPAMo.com> wrote in message
> news:SOSdnbivzvT-3MzdRVn-gg@texas.net...
> > "Amy G" <amy-g-art@cox.net> wrote in message
> > news:%Ua4c.22359$BA.16233@fed1read03...
> > > java.lang.IllegalStateException: getOutputStream() has already been
> called
> > >
> > > This is the error message that is getting attached to the end of the
> > binary
> > > files I am uploading from the server to the enduser. How do I get rid
of
> > > this message? Or redirect it to somewhere other that the OutputStream?
> > >
> > > Following is my code. Any help is greatly appreciated.
> > >
> > > <%@ page language="java"%>
> > > <%@ page import="java.io.*"%>
> > > <%@ page import="java.util.*"%>
> > > <%@ page import="javax.servlet.*"%>
> > > <jsp:useBean id="ppv" class="com.dpcsys.ppv" scope="session"/>
> > > <%
> > *snip*
> > > ServletOutputStream writer =
response.getOutputStream();
> > *snip*
> > > %>
> > >
> >
> > You can only call getOutputStream or getWriter once on a response
object.
> > Your JSP has already done so to create its implicit "out" object. Unless
> I'm
> > mistaken, you can get another output object if you close the existing
one.
> > Aside from that, this code doesn't really belong in a JSP. It belongs in
a
> > servlet.
> >
> >
>
> I understand that it would be better suited for a servlet... however, I
have
> no desire to install jsdk for this one page, when I figure that I can
> accomplish it with a JSP page.
>
> But, how would I go about closing the output object based on my existing
> code.
>
> Thanks for the response.
>
JSPs are translated to servlets before they are compiled. If you can run a
JSP, you can run a servlet. As for closing out: out.close()
- Next message: Matthew Macchia: "Re: implementing class files in different location for tomcat 4.1"
- Previous message: Max: "Re: Get Difference Between 2 images : very Slow"
- In reply to: Amy G: "Re: getOutputStream() has already been called???"
- Next in thread: Amy G: "Re: getOutputStream() has already been called???"
- Reply: Amy G: "Re: getOutputStream() has already been called???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|