You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mi...@honeywell.com on 2002/07/01 16:57:18 UTC

Trouble getting .pdf into the URL

Hello,

I'm trying to get a parameter (dummy=.pdf) into my URL in order for IE to
realize that it should display the pdf with Acrobat.  Unfortunately, I'm
hitting dead-ends.  I'm running the action which generates the pdf via a
form submit in order to handle some input fields for the search criteria of
the report.  I have a simple report where there are no input paramters and I
was able to use a <html:link> successfully to display the report using
<html:link page="/do/varianceTotal?dummy=.pdf">.  This works perfectly
everytime.  So, when I set up the action I tried adding the parameter to the
action attribute like: <html:form method="POST"
action="/runVarianceReport?dummy=.pdf" focus="transactionRegion"> but this
caused an error because it couldn't find the action servlet (I'm assuming
because "/runVarianceReport?dummy=.pdf"  != "/runVarianceReport").  So, I
tried changing the struts-config.xml to match, but then I got the error:
java.lang.StringIndexOutOfBoundsException: String index out of range: 25.

Next, I got the bright idea that I could create a second action and forward
to that action using a redirect and include the parameter in the URL.  Seems
like this idea would work, but for a reason which I haven't figured out,
absolutely nothing happens at the end of my first action (as if I'm
returning null).  My struts-config.xml for this looks like:

    <!-- Run variance report program -->
    <action path="/runVarianceReport" 
        name="ARVarianceReportForm"
        type="com.omnicare.ar.araging.webapp.ARVarianceReportAction"
        scope="request"
        validate="false"
        input="/do/varianceReport"
        parameter="runreport">
      <forward name="showpdf" path="/do/displayPDF?dummy=.pdf"
redirect="true" />
    </action>

    <!-- Generate the PDF -->
    <action path="/displayPDF"
        type="com.omnicare.ar.araging.webapp.ARDisplayPDFAction">
    </action>

and in my java code, I do: return (mapping.findForward("showpdf"));

Thank you in advance for any help,

Mike Witt


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>