Use StringBuffer. It is more efficient to use StringBuffer.append() than to
concatenate Strings.
I have a servlet that functions in the way mentioned below... I write all
the response into a StringBuffer and then write the StringBuffer into the
response at the very end.
Kevin Baynes
Seagull Software
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Ed
> Sabine
> Sent: Tuesday, August 28, 2001 12:49 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Buffering Response
>
>
> you could build up the response in a string throughout the servlet and at
> the end decide to redirect or output the string
>
> don't know if this has memory implications though
>
> ed
>
> -----Original Message-----
> From: Hans Liebenberg [mailto:[EMAIL PROTECTED]]
> Sent: 28 August 2001 14:03
> To: [EMAIL PROTECTED]
> Subject: Buffering Response
>
>
> Hi,
>
> How do you buffer the response. I.e The response must only be sent to the
> output stream after the request is complete.
> Obviously when I call response.sendRedirect() and out put has already been
> sent it bombs.
>
> Thanks
> Hans
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html