Forums Register Login

what commits the response ?

+Pie Number of slices to send: Send
hfsj says,

flush( ) commits the response.
so we cant call anything on the response ( methods to do sendRedirect( ) and adding/setting things in the response ), once we say flush( ).

my query is if, after the response is commited, and i say
out.println( ), where out is a PrintWriter, what will happen ?
+Pie Number of slices to send: Send
If the response is commited you cant forward to any other servlet. You have to choose. Either commit the response and handle the content yourself or forward to another servlet/JSP without commiting the response
+Pie Number of slices to send: Send
It will give you an IllegalStateException as it is given in the specs.
+Pie Number of slices to send: Send
thanks
Poop goes in a willow feeder. Wipe with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 671 times.
Similar Threads
cleared, commited and flushed
sendRedirect()
Confused with flush() behavior
can sendError be called after flush()??
Q on ServletResponse: more ways to commit a response?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 23:51:30.