This solution seems to work great, but any output of the page AFTER the
output of the servlet does not appear. I assume this is because of the
"flush" parameter. If this is the case, then how do I get around THIS?
BTW, I was in fact using the getOutputStream() method instead of
getWriter().
I will try the other suggestions over the next couple of days to see how
well they work as well. I've never written a bean, so I will get some
experience in that area as well. :-)
Thanks to all who responded!
Bob
-----Original Message-----
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 23, 2001 4:35 PM
To: [EMAIL PROTECTED]
Subject: Re: Invoking a servlet from JSP
"Robert E. Baker" wrote:
> I have a self-contained servlet that returns a single value. I am trying
to
> include the output of this servlet in-line on an HTML/JSP page. When I
try
> to invoke the servlet using the following JSP INCLUDE tag, the page bombs
> with Exception #500 (java.lang.IllegalStateException: Writer is already
> being used for this request):
>
> <jsp:include page="/servlet/TestServlet" flush="true">
> <jsp:param name="type" value="apples" />
> </jsp:include>
>
How does your servlet create its output? If the servlet calls
response.getWriter(), this should work fine because it will use the same
output
writer that the JSP page is using. You should only hit this exception if
your
servlet tries to call response.getOutputStream() instead.
Craig McClanahan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]