Tuesday, February 14, 2012

Redirect Configurator Extension to new Window

Use below method         
Attach it to the [on command] event of any button.

 public void generateOutput(IRuntimeNode rtNode, HttpServletResponse response)
 {
                        PrintWriter out = response.getWriter();
                        response.setContentType("text/html");
                        response.sendRedirect("www.google.com");
}


or you can embed HTML response in the page.

public void generateOutput(IRuntimeNode rtNode, HttpServletResponse response)
 {

                        PrintWriter out = response.getWriter();
                        response.setContentType("text/html");
                                     sHTML = "<html>\n" +
                                                            "<head>\n " +
                                                            "<title>Information</title><script language='javascript' type='text/javascript'>\n " +
                                                            "function closeWindow(){" +
                                                            "alert('closedd');" +
                                                            "}" +
                                                            "</script></head>\n " +
                                                            "<body onunload='closeWindow()'> " +
                                                            "</body>\n"+
                                                            "</html>\n";
                                                            out.println(sHTML);
}

No comments:

Post a Comment