4

Trying to open a new tab to accept a generated pdf file from the bean.

Works with h:commandbutton, no tab opened with p.commandbutton.

Tried to put onclick and oncomplete="window.open('_blank') on the p:commandbutton, it opens a new tab but it doesn't get the pdf and gets "Error 404 Not Found".

Using primefaces-3.1

Thanks

  <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
     'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>

     <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">


    <h:head>
        <h:outputStylesheet library="base" name='jquery-ui-1.8.16.custom.css' />
    </h:head>
    <h:form target="_blank">
      <p:commandButton value="Run" action="#{bean.createReport}"  />
    </h:form>

    </html>
Daniel
  • 36,833
  • 10
  • 119
  • 200
mccmike
  • 41
  • 1
  • 1
  • 2

1 Answers1

7

Try to set

ajax="false"

On your p:commandButton, this way it should behave like h:commandButton

Daniel
  • 36,833
  • 10
  • 119
  • 200