Re: java.lang.IllegalStateException: "getOutputStream()" has already been called for this response
John Arockiaraj <[email protected]>
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Message-ID | <[email protected]> |
Hi, Are you calling RequestDispatcher.forward() method anywhere in your servletA or in servletControl? Because the rule for 'forward()' method goes : <quote> If you have already accessed a ServletOutputStream or PrintWriter object within the servlet, you cannot use 'forward()' method; it throws an IllegalStateException. </quote> HTH John -----Original Message----- From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[email protected]]On Behalf Of Jean-Baptiste Nokl Sent: Friday, May 09, 2003 7:45 AM To: [email protected] Subject: java.lang.IllegalStateException: "getOutputStream()" has already been called for this response Hi, I have this error above when i load the same servlet in my webapp. My Code looks like following : my servletA is : response.setContentType("text/html; charset=ISO-8859-1"); PrintWriter out = response.getWriter(); out.println("test"); out.println(....a form who submit to servletControl....); my servletControl is : if(ok)//call servletA RequestDispatcher rd2 = request.getRequestDispatcher("servletA"); rd2.include(request, response); In first i call servletA. The result is test and a form to submit to servletControl In second i submit the form. The result is java.lang.IllegalStateException: "getOutputStream()" has already been called for this response Thanks you for your help ___________________________________________________________________________ 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