File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Trouble with question : HFSJ Ch. 5 Q.12 Pg. 213/219 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 "Trouble with question : HFSJ Ch. 5 Q.12 Pg. 213/219" Watch "Trouble with question : HFSJ Ch. 5 Q.12 Pg. 213/219" New topic

Trouble with question : HFSJ Ch. 5 Q.12 Pg. 213/219

Jeremy Leong

Joined: May 25, 2004
Posts: 5
Hi all, I've been stuck on this question for awhile, I can't seem to find any answers it. Any help would be appreciated.

My problem lies with Answer D which the book says should be true :
"The servlet to which a request is forwarded may access the original query string by calling getQueryString() on the ServletRequest."

Now it is my understanding from reading the Servlet Spec. Ch. 8 that :

a. The original query string will be stored in the "javax.servlet.forward.query_string" attribute of the ServletRequest object,

"The values of these attributes must be equal to the return values of the
HttpServletRequest methods getRequestURI, getContextPath, getServletPath,
getPathInfo, getQueryString respectively, invoked on the request object passed to the first servlet object in the call chain that received the request from the client." Pg. 66

b. The query string of the forwarded servlet is accessible through the request.getQueryString() method.

"The path elements of the request object exposed to the target servlet must
reflect the path used to obtain the RequestDispatcher." Pg.66

Doesn't this mean you can only get the original query string from the javax.servlet.forward.query_string attribute, and not the getQueryString method as stated in the answer ?
[ September 27, 2005: Message edited by: Jeremy Leong ]
Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
I dont think answer D is correct, too. My concern is same as yours, it should be through the "javax.servlet.forward.query_string"
I agree. Here's the link:
subject: Trouble with question : HFSJ Ch. 5 Q.12 Pg. 213/219
It's not a secret anymore!