Forward Call from a Servlet : Redirect « Servlets « Java






Forward Call from a Servlet

 

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Main extends HttpServlet {

  protected void service(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    RequestDispatcher dispatcher = request.getRequestDispatcher("/p.jsp");

    dispatcher.forward(request, response);
  }

}

   
  








Related examples in the same category

1.Redirect to New Location
2.Servlet redirect
3.Servlet: URL redirect
4.Servlet: URL rewrite
5.Redirect Servlet Call to Another URL
6.Client auto refresh