Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 35974 invoked from network); 8 Mar 2002 15:17:25 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 8 Mar 2002 15:17:25 -0000 Received: (qmail 20634 invoked by uid 97); 8 Mar 2002 15:16:56 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 20576 invoked by uid 97); 8 Mar 2002 15:16:55 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 20546 invoked from network); 8 Mar 2002 15:16:54 -0000 Message-ID: <72F7D4A84579D511A4300090273F6EFC59A8BC@ERLANGER> From: "Wagoner, Mark" To: 'Tomcat Users List' Subject: RE: How can I resolve this "IllegalStateException: Response has a lrea dy been committed" problem? Date: Fri, 8 Mar 2002 10:16:23 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Because the Home servlet holds an object reference to the session, it acts as a pointer to the actual object data. If another servlet obtains a pointer to the same object and modifies the data, the changes will be reflected in the first servlet without having to re-get the reference. However, as a precaution I don't like to hold object references between calls like this. Maybe I'm just anal... -----Original Message----- From: lindsay.hamoudi@bt.com [mailto:lindsay.hamoudi@bt.com] Sent: Friday, March 08, 2002 10:06 AM To: tomcat-user@jakarta.apache.org Subject: RE: How can I resolve this "IllegalStateException: Response has a lrea dy been committed" problem? OK. I never knew the forward call actually returned - ever. I will experiment with this. I'm nearly ready to go away and stop pestering you all, but one more question... Say the Home servlet gets the session object from the request. It later forwards the request to the Create servlet, which essentially modifies the session. Then, when the forward call returns, will the Home servlet's session object be the old one or the updated one? Or will it have to do request.getSession() all over again in order to get latest session. Cheers, Lindsay -----Original Message----- From: Wagoner, Mark [mailto:MWagoner@wildflavors.com] Sent: 08 March 2002 14:52 To: 'Tomcat Users List' Subject: RE: How can I resolve this "IllegalStateException: Response has a lrea dy been committed" problem? Actually, the way forward works came as a surprise to me as well. And I only figured it out after a few days of testing and head-scratching. :) Since the session is held in the request object, changes made to it should be available to the original Home servlet by calling request.getSession after the forward call returns. Obviously I'm not real familiar with what you are trying to do, but there may be a way you can eliminate the last forward back to the home servlet. -----Original Message----- From: lindsay.hamoudi@bt.com [mailto:lindsay.hamoudi@bt.com] Sent: Friday, March 08, 2002 9:44 AM To: tomcat-user@jakarta.apache.org Subject: RE: How can I resolve this "IllegalStateException: Response has a lrea dy been committed" problem? Don't think JSP is failing. It's quite a simple JSP and has been looked at exhaustively! Yes, I am setting session attributes in Create servlet, for use by create.jsp. I am only using the session object and the request throughout my application. The only time I ever knew I was using the response object was when I used response.sendRedirect(), but I don't use this anymore. I use the RequestDispatcher. There are no or tags being used anywhere, and my servlets do not contribute anything to the response (apart from forwarding it around). Mark - your words of wisdom interest me. I thought that... when I invoke requestDispatcher.forward(), then control never returns (to the line following this invocation). So how do I go about "returning" to the Home servlet from the "Create" servlet. Surely I need to "forward", because the session has changed? I have a lot to learn here I think, but I feel I'm getting closer to the holy grail - getting rid of this exception! -----Original Message----- From: Attila Szegedi [mailto:szegedia@freemail.hu] Sent: 08 March 2002 13:56 To: Tomcat Users List Subject: Re: How can I resolve this "IllegalStateException: Response has a lrea dy been committed" problem? I guess you JSP is failing with an uncaught exception. At that point, Tomcat would try to send a "500 Internal Server Error" response code, but it can't since a "200 OK" status code has already been sent (that is, the output committed) to the client. -- Attila Szegedi home: http://www.szegedi.org ----- Original Message ----- From: To: Sent: 2002. m�rcius 8. 14:45 Subject: RE: How can I resolve this "IllegalStateException: Response has a lrea dy been committed" problem? > The exception seems to be occurring because the Home servlet forwards more > than once (to different locations) - first to home.jsp, then later to the > Create servlet. > It is definitely the fact that it is forwarding to more than one place, that > is causing the problem. I know this because if I call the Login servlet and > fail the login authorization - this servlet consequently forwards to > login.jsp more than once (first - to display the fresh login page, and > second - to prompt user to try again). This however does not give me an > exception. > Given that my Home servlet is like the "central" servlet, it needs to be > capable of forwarding to a variety of places, depending on the activity > selected by the user. > Ryan - I have looked at create.jsp and, as far as my little mind can see, it > does not play with the response object at all. All it does is get a few > session attributes and fit them into the page using <%= blablabla %>. Could > that be a problem? > This problem is not isolated to the "Create" example. There are other > activities the user can choose which all follow exactly the same forwarding > mechanism (except to different servlets), and these give exactly the same > exception. > > > Lindsay > -- To unsubscribe: For additional commands: Troubles with the list: -- To unsubscribe: For additional commands: Troubles with the list: -- To unsubscribe: For additional commands: Troubles with the list: -- To unsubscribe: For additional commands: Troubles with the list: -- To unsubscribe: For additional commands: Troubles with the list: