Trouble with question : HFSJ Ch. 5 Q.12 Pg. 213/219
Joined: May 25, 2004
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 ]
Joined: Jan 28, 2004
I dont think answer D is correct, too. My concern is same as yours, it should be through the "javax.servlet.forward.query_string"