Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ 1st edition errata repeated in 2nd edition final Mock

 
NishaP Raj
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In a doGet() method,
OutputStream os = response.getOutputStream();
byte[] ba = {1,2,3};
os.write(ba);
RequestDispatcher rd = request.getRequestDispatcher("my.jsp");
rd.forward(request,response).
Assuming "my.jsp" adds bytes 4,5,6 to the response which is correct?
Options:-
a.123
b.456
c.123456
d.456123
e.IllegalStateException is thrown.

Errata in one of the question in HFSJ 1st edition says flush and write both commit the response. So e should be the answer. But book mentions b. Please clarify?
 
Dee Brown
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question appears incomplete, but I assume it is asking what will be displayed. I believe "b" is correct because on a forward, anything written to the response prior to the forward is discarded.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic