Trouble with question : HFSJ Ch. 5 Q.12 Pg. 213/219
Jeremy Leong
Greenhorn
Joined: May 25, 2004
Posts: 5
posted
0
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: 568
posted
0
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: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.