1 Reply Latest reply on Jun 7, 2007 1:17 PM by Dustin Norlander

    render pdf without landing on blank page?

    Dustin Norlander Apprentice

      Hi,

      I am trying to render a pdf using an action, problem is that it always lands me on a blank page.. I would settle for opening in a new window, but I can't get that to work either.

      my export() method returns the view of the report to render, but I need to submit the form so s:button doesn't work..

      <h:form id="graphreport_fm">
       <s:validateAll>
      
       <h:outputLabel styleClass="form-label" for="title">Title:</h:outputLabel>
       <br />
       <s:decorate>
       <h:inputText size="30" id="title" value="#{graphReport.report.title}" />
       <s:message />
       </s:decorate>
       <br />
      
       <!-- other options -->
      
       </s:validateAll>
       <s:button onclick="document.forms['graphreport_fm'].submit();" value="Export Now" action="#{graphReport.export()}" target="_new"/>
       </h:form>
      


      Where my export method is something like:

      public String export() {
       return generateReportViewId();
       }
      


      that leads to the following message:

      
      INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=null[severity=(WARN 1), summary=(The conversation ended, timed out or was processing another request), detail=(The conversation ended, timed out or was processing another request)]
      


        • 1. Re: render pdf without landing on blank page?
          Dustin Norlander Apprentice

          To answer my own question:

          <!-- want this action to open in new window -->
          <h:commandButton
           value="Export Now"
           action="#{graphReport.export()}"
           onclick="document.getElementById('graphreport_fm').target='_new';"
          />
          
          <!-- dont want this action to open in new window -->
          <h:commandButton
           value="Save"
           action="#{graphReport.email()}"
           onclick="document.getElementById('graphreport_fm').target='';"
          />