Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HF SCJP mock exam question: flush() vs. write()

 
Jean-Christian Imbeault
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapetr 5, page 209, mock exam question #1 asks:

"When using a requestDispatcher, the use of which method can often lead to an IllegalStateException (choose all that apply):

A. read
B. flush
C. write
D. getOutputStream
E. getResourceAsStream

The correct answer is given as B, but I would have though the answer should have been B *and* C.

Couldn't writing 'theoretically' cause the response to be commited and hence cause and IllegalStateException if we try and forward the request?

Or is it in the specification that nothing is sent to the browser until flush() is called or the servlet's service method returns?
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this not an SCJP 1.2 mock question?
 
Jean-Christian Imbeault
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops! Wrong forum. Sorry!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic