redirect Only HttpServletResponse - Java javax.servlet.http

Java examples for javax.servlet.http:HttpServletResponse

Description

redirect Only HttpServletResponse

Demo Code


import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletResponse;

public class Main{
    public static void redirectOnly(HttpServletResponse response,
            String jsp_Page) throws IOException {
        response.setContentType("text/html; charset=UTF-8");
        PrintWriter out = response.getWriter();
        out.println("<script>");
        out.println("window.location.replace('" + jsp_Page + "');");
        out.println("</script>");
    }/*w w w .  j av  a 2  s  . c o  m*/
}

Related Tutorials