How do you determine the path to a file when you use getRequestDispatcher() before forward()'ing the request to the file?
In an example I am working on (in HF
Servlets &
JSP, p. 89), this is the directory structure:
tomcat ----webapps
---------Beer-v1
----------------form.htm
----------------result.jsp (the View)
----------------WEB-INF
-----------------------web.xml
-----------------------classes
----------------------------com
---------------------------------example
---------------------------------------web
-------------------------------------------BeerSelect.class
---------------------------------------model
-------------------------------------------BeerExpert.class
In the BeerSelect servlet is the following code:
I don't understand how the path "result.jsp" is arrived at. In what I would consider a glaring omission in HF Servlets & JSP not in keeping with the rest of the book, there is no discussion on how that path is arrived at.
I have another book, Murach's Servlets and JSP, and it says (on p.176):
Within the getRequestDispatcher() method, you must code a URL that starts with a slash so it is relative to the document root directory.
Is that correct? And therefore, the HF book is wrong? I checked the HF errata and nothing was noted there.
[ October 09, 2006: Message edited by: sven studde ]