This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
When solving the Exercise 12 from chapter 5 of Head First Servlets & JSP, the statement below was said to be wrong.
"The Servlet to which a request is forwarded may access the original query string by calling getQueryString() on the HttpServletRequest."
It's said in the book that this is incorrect because this method returns the query string on the URL pattern from the RequestDispatcher.
When trying by coding an example I've seen that the statement above is true and not wrong as said the book.
I've created two Servlets called SourceServlet.java and DestineServlet.java.
The SourceServlet is called with a GET method from a link from any html page as
When checking the query string data at SourceServlet, those data is there as expected.
So I've coded a dispatching to DestineServlet to check there for URL parameters and queryString invocation method.
The result was as I've expecting: when invoking the getQueryString method, I've got the value name=adscript.
So I'd like to know if I'm interpreting this exercise wrong, or it's an error at the answer provided by HF Servlets & JSP.
Note: I'm reading the second edition. At the first edition, the statement was said to be true.