Do you have any html tags in your jsp file before the logic you mention?
Also, what jsp spec are you using?

-----Original Message-----
From: Jerry Jalenak [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 17, 2002 3:26 PM
To: '[EMAIL PROTECTED]'
Subject: response.sendRedirect


I have the following code snipet in a .JSP...

                if (userStatus.equals ("Failed"))
                {
                        session.invalidate() ;                  // Kill this
session.
                        response.sendRedirect(htmlHome) ;       // Redirect
the user to our home page.
                        return ;
                }

When this condition occurs, the response.sendRedirect fails with the
following message:

        javax.servlet.ServletException: Response has already been committed

According to the response object documentation, the sendRedirect 'must be
called before the response is committed (in other words, before the status
code and headers have been written).' Obviously, the response has been
committed, else I wouldn't be getting the error!

My question - is the session.invalidate() doing this to me, or is it
something else that I am completely unaware of?

Thanks.

Jerry Jalenak
LabOne, Inc.

This transmission (and any information attached to it) may be confidential
and is intended solely for the use of the individual or entity to which it
is addressed. If you are not the intended recipient or the person
responsible for delivering the transmission to the intended recipient, be
advised that you have received this transmission in error and that any use,
dissemination, forwarding, printing, or copying of this information is
strictly prohibited. If you have received this transmission in error, please
immediately notify LabOne at (800)388-4675.



--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>



--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to