4 Replies Latest reply on Jan 10, 2012 6:36 AM by Sreenivasulu N

    How to open separate new window using h:commandButton Or a4j:commandButton

    Sreenivasulu N Newbie

      I am trying to open separate new window using h:commandButton. But by using following code, i am not able to open separate new window.

       

      My Jsp Code:

       

      <h:commandButton id="genReport"

                                  value="Generate Report" action="#{reportBean.generateReport}">

      </h:commandButton>

       

       

      Bean Code:

       

      HttpServletResponse res =

                          (HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();

                      res.getWriter().println("<script>window.open('" +

                                              reportURL.toString() + "');</script>");

       

       

       

      Please anyone give me clarification.

       

      Thanks in advance.