This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Jeremy Leong
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think answer D is correct, too. My concern is same as yours, it should be through the "javax.servlet.forward.query_string"
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!