2 Minutes To Code (β Version)

Java Servlets - 2 minute tutorial

How to redirect http request to any other webpage on any webserver

To redirect an http request to any other url, you need to use the method sendRedirect(String url) of the HttpServletResponse object where target url is the location where you want to redirect the request.

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
	resp.sendRedirect("/main/login.jsp");
}