Luigi answered the POST question. If the report, however, is available at the request of GET, then there are other ways.
Use window.open() in oncomplete .
<h:form> ... <p:commandButton action="#{bean.submit}" update="@form" oncomplete="if (args && !args.validationFailed) window.open('reportURL')" /> </h:form>
Or conditionally draw a <h:outputScript> using window.open() .
<h:form> ... <p:commandButton action="#{bean.submit}" update="@form" /> <h:outputScript rendered="#{facesContext.postback and not facesContext.validationFailed}"> window.open('reportURL'); </h:outputScript> </h:form>
Or use PrimeFaces RequestContext#execute() with window.open() .
public void submit() {
The first method requires that the URL has already been determined before sending, the last two methods allow you to use a dynamic URL, for example window.open('#{bean.reportURL}') .
source share