Hi Martin,

I am delegating the pdf generation from the action class to a different
class, that uses itext to generate PDF, which inturn provides the bytestream
to the action class. Action Class writes these bytes to the browser and then
flushes the stream.

Here is the sample code for your reference..

// body of the execute method
{
...
...
    try {

        PDFDelegate delegate = new PDFDelegate();
        baos = (ByteArrayOutputStream)delegate.generatePDF(hashMapParams);

        response.setContentLength(baos.size());

        response.setHeader("Content-disposition", " inline;
filename=Document.pdf");

        ServletOutputStream sos = response.getOutputStream();
        baos.writeTo(sos);

        sos.flush();
    }
    catch (Exception e) {
    }
}

To add up, I noticed this problem when I was in debug mode in eclipse 3.0. I
use JBoss 3.2.3.

Thanks

Thomas Joseph

From: "Martin Gainty" <[EMAIL PROTECTED]>

> Thomas Joseph-
>
> How are you generating the PDF?
>
> Martin --
> *********************************************************************
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please
notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
>
>
>
> ----- Original Message -----
> From: "Thomas Joseph" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Sent: Tuesday, July 11, 2006 1:29 AM
> Subject: Action called multiple times
>
>
> > Hi all,
> >
> > I have got a strange problem. My action class generates PDF, and writes
on
> > the the response and fushes it, but I can see that this action is
getting
> > called multiple times (2-5 times). I have cheked my struts-config to be
just
> > perfect (No forwards)
> >
> > What may be the reason for this? What can be the checklist I can have to
> > rectify this?
> >
> > Thanks in advance.
> > Thomas Joseph
> >
> >



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to