to the main page about the tutorial  INTERACTIVE WEB SERVICES WITH JAVA back up next

Request Dispatcher

Services are often composed of many Servlets (and JSP pages) working together.

Forwarding a request to another Servlet using RequestDispatcher:
RequestDispatcher dispatcher = 
  getServletContext().getRequestDispatcher("/my_other_app/servlet/SomeServlet");
dispatcher.forward(request, response);

request.setAttribute(String,String) can be used to supply extra data to the new handler

back COPYRIGHT © 2002-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH next