Hi,
I have a simple but irritating to solve problem.
I have a JSP which calls a servlet which in turn calls another JSP page. I
am using code from "Core servlets and JavaServer pages" to do this (Listing
15.3).
private void gotoPage(String address,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher(address);
PrintWriter out = response.getWriter();
if (dispatcher!= null){
out.println("dispatcher not null");
}
else{
out.println("dispatcher is null");
}
dispatcher.forward(request, response);
}
I think the problem is that I need to know the relative path from the
servlet location to the jsp page location in order to 'tell' the servlet
where to look for it. This I seem to be failing to do as the page always
reads dispatcher is null suggesting that the
getServletContext().getRequestDispatcher(address) is failing.
Can any Tomcat users out there assist?
Many thanks in advance.
Eoin.
~
"Ní hé lá na gaoithe lá na scolb"
T: +353 1 6710692
F: +353 1 6710863
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets