2 Minutes To Code (β Version)

Java Servlets - 2 minute tutorial

Forward Request - To any webpage in the same app

To forward the incoming http request to a different url on the same web app, you can use the RequestDispatcher object, using the getRequestDispatcher(String url) method on the ServletContext object. And then just call the forward(..) method on it.

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
	RequestDispatcher rd = getServletContext().getRequestDispatcher("/main.checkout.jsp");
	rd.forward(req, resp);
}