I have a book on Tomcat. In a section entitled, "Forwarding HTTP Requests"
reference is made to the fact that sometimes it's desirable to branch form a
servlet to an alternative URL upon the occurrence of some condition such as
encountering an exception. The book provides the following sample code for
accomplishing the branch:
RequestDispatcher rd = request.getRequestDispatcher("/alternative_url")
if (rd != null)
rd.forward(request, response);
I can't get the above code to work. At compile time I get 3
cannot-find-symbol errors. The 3 symbols that can't be found are
"getRequestDispatcher", "request", and "response". I'm not at all surprised
about the "request" and "response" symbols as they appear to be undefined.
I really expected that getRequestDispatcher would have been found in
javax.servlet.* which is imported.
Can someone please tell me what I am missing or point me to some detailed
documentation which fill in the blanks so that I can get this thing to
work? Thanks for any input.
... doug