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.
The final mock examin in hf question #56 says ("xyz") is a valid argument to getServletContext().getRequestDispatcher(). This directly contradicts p. 204, where a 'handwritten' note says you must provide an absolute path to the page. The mock question says that a relative path is appropriate here or something like that. What is the underlying theory?
On a related note, if a relative path is relative to the location of the request, and if the request is being dispatched from a servlet, how could you have a 'result.jsp' in the SAME directory?
It is like this : only the dispatcher obtained from the ServletRequest can accept accept a relative path, that means you may use the paths which are not starting with "\". If you use the ServletContext you must use paths which are stating whit "\".
Look closer at page 204. You will see that there is no contradiction. It explains the difference between the RequestDispatcher obtained from the request and the RequestDispatcher obtained form the ServletContext.