How Can I Open A Window Popup In Servlet And Then Redirect A Page
I want to open a popup window on calling a servlet and then want to redirect servlet to some .jsp page. This is what i've done: protected void doGet(HttpServletRequest request, Htt
Solution 1:
You can use JavaScript do the trick. For example:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("<html><body>");
out.println("<script type=\"text/javascript\">");
out.println("var popwin = window.open(\"pageA.jsp\")");
out.println("setTimeout(function(){ popwin.close(); window.location.href='pageB.jsp';},5000)");
out.println("</script>");
out.println("</body></html>");
}
Post a Comment for "How Can I Open A Window Popup In Servlet And Then Redirect A Page"