There is a code snippet in HFSJ on page 236 demonstrating the use of encodeURL. There is a line which says:
out.println("<a href\"" + response.encodeURL("/BeerTest.do") + "\">click me</a>");
I don't think the URL
string used would work....While tryin' out encodeURL() I found out that the forward slash "/" in "
/BeerTest.do" actually denotes the web container and not the context root(web application).....it's similar with encodeRedirectURL() as well.... I checked in the errata list but its not there....Could anybody please confirm this?
Also, if this is true then usage of "/" with sendRedirect(), encodeURL(), encodeRedirectURL() would mean relative to the web container and the usage in everything else like getRequestDispatcher() in ServletRequest, etc. would mean relative to the context root(root of the web application).
Am I right?