wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes what commits the response ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "what commits the response ?" Watch "what commits the response ?" New topic
Author

what commits the response ?

Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
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 ?


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

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


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9350
    
    2

It will give you an IllegalStateException as it is given in the specs.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: what commits the response ?