One of the previous methods for calling another servlet was
HelloServlet hello = (HelloServlet)getServletConfig().getServletContext().getServlet("hello");
From Servlet API version 2.1, this method has been deprecated and the preferred method is to use RequestDispatcher. Here is the syntax for it,
getServletContext().getRequestDispatcher("/jsp/hello/hello.jsp").forward(req, res);
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment