This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Hello Consider following scenario: My application is generating the xml file.I am writing that xml file in jsp out stream thru a method of bean
queryBean.save( out ); where out is implicit object of jsp. Now is file is very large I get IllegalStateException saying response already been committed. Now questions are a) Can I increase buffer size in page directive of jsp depending on the file size i want to write.
b) Is there any upper limit on the buffer size for jsp regards sharang
Hello, Well,I cannot help u much . I dont know whether ur problem is related bcoz of buffer or not . but u can increase the size of buffer. By default what is avilable is 8 kb .If u want in the page directive u canmenthion the buffer =12 ------------------ Sandeep Jain
Try and Try Till u succeed<br /> <br />Sandeep Jain
Rather than increasing the buffer size and thereby the footprint of your application, why not move every statement that needs to set header fields is executed before you generate your data. - Peter
Joined: Dec 07, 2000
Hi I think there is some flaw in my understanding. What i understand is if there is very large data to be written in stream of jsp and if buffer size is lesser than that then moment buffer is full response will be sent to client and further to that what ever u try to right will give IllegalState Exception. With this understanding Peter i am not able to get what u r trying to say. Will u please elaborate kindly. regards sharang
Peter den Haan
Joined: Apr 20, 2000
Originally posted by Sharang Thorat: What i understand is if there is very large data to be written in stream of jsp and if buffer size is lesser than that then moment buffer is full response will be sent to client and further to that what ever u try to right will give IllegalState Exception.
That's not quite how it works. When the output buffer is full, its contents are sent to the client, the buffer is emptied and ready to send as much data as you want. The problem is that your servlet's or JSP's response consists of two parts. The first part is the header, which includes things like the response code, last modified date, content length, etcetera. The second part is your actual response (html or whatever). Once the buffer has been flushed, the header will have been sent (committed) to the client. If you then try to do anything which needs to get at the header fields, you will get an IllegalStateException: response already committed. Operations which need the response header include a forward or redirect. - Peter