File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Mock Exam/Chap-5/Bryan Basham Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Mock Exam/Chap-5/Bryan Basham" Watch "Mock Exam/Chap-5/Bryan Basham" New topic
Author

Mock Exam/Chap-5/Bryan Basham

Vivek Kinra
Ranch Hand

Joined: Mar 11, 2006
Posts: 66
According to book and also I think the answer to question 1 is B only

when using a RequestDispatcher, the use of which methods can often lead to an IllegalStateException?

A) read
B) flush
c) write
D) getOutputStream
E) getResourceStream

but the errata of book on oreilly website says
[215] Answer to question 1;
Option C should also be checked. i.s write is also true

I am also adding a response by Bryan Basham in one of the post By Bryan

Any answers???
Ernesto Leyva
Ranch Hand

Joined: Feb 23, 2006
Posts: 62
I think this is a semantic problem.

For instance this other link explains how to throw and exception when invoking a getOutputStream and a request dispatcher.

But I believe both links exemplifies extraordinary circumstances.

While the question refers to the common case when a RequestDispatcher
will throw the exception. The question says

when using a RequestDispatcher, the use of which methods can often lead to an IllegalStateException?


in that context flush() is the most common case.
if you are rigorous write() and getOutputStream may potentially throw an IlegalStateException, as well.
Vivek Kinra
Ranch Hand

Joined: Mar 11, 2006
Posts: 66
That means this answer in errata is wrong???
Akshay Kiran
Ranch Hand

Joined: Aug 18, 2005
Posts: 220
Ernest,

can you provide an example where write and getOutputStream trigger an exception?


"It's not enough that we do our best; sometimes we have to do<br />what's required."<br /> <br />-- Sir Winston Churchill
Madhu Sudhana
Ranch Hand

Joined: Apr 16, 2006
Posts: 127
Please provide an example where write can through the IllegalStateException

Thanks in advance


"And the trouble is, if you don't risk anything, you risk even more." -- Erica Jong.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Mock Exam/Chap-5/Bryan Basham
 
Similar Threads
Passed OCPJWCD - 82%
EL ? : Operator
scwcd book
Just Cleared @ 90%
Question to authors about HFSJ end-of-chapter mock questions