struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shawn McKisson" <sh...@earthaura.com>
Subject Re: ActionServlet return a pdf document
Date Tue, 16 Oct 2001 21:14:15 GMT
So that you don't have to worry about Model layer exceptions being thrown
when rendering the view, it's usually best to have the controller speak to
the model and then pass the relevant data to the view.

Since all JSPs are compiled to servlets anyway, having a "servlet view" is
no different than having a "JSP view". Your presentation servlet should not
have to speak to the model, but instead should get all it's data from the
controller.

--shawn

----- Original Message -----
From: <dhay@lexmark.com>
To: <struts-user@jakarta.apache.org>
Sent: Tuesday, October 16, 2001 1:44 PM
Subject: Re: ActionServlet return a pdf document


>
>
> What if the servlet needs to access stuff in your model?  This way you
have your
> view accessing your model!
>
> Dave
>
>
>
>
>
> "Shawn McKisson" <shawn%earthaura.com@interlock.lexmark.com> on 10/16/2001
> 07:49:47 AM
>
> Please respond to struts-user%jakarta.apache.org@interlock.lexmark.com
>
> To:   struts-user%jakarta.apache.org@interlock.lexmark.com
> cc:    (bcc: David Hay/Lex/Lexmark)
> Subject:  Re: ActionServlet return a pdf document
>
>
>
> I disagree with having the an Action spit out content because that
combines
> your Controller and View.
> The logic below should be placed into a servlet that lives in your View.
>
> --shawn
>
> ----- Original Message -----
> From: "Geddes, Mark (ANTS)" <mark.geddes@ants.co.uk>
> To: <struts-user@jakarta.apache.org>
> Sent: Tuesday, October 16, 2001 6:00 AM
> Subject: RE: ActionServlet return a pdf document
>
>
> > To shamelessly quote Craig from a previous mail:
> >
> >
> > This is one of the cases where you might actually want to have an Action
> > create the response itself, instead of forwarding to a JSP page to do
> > it.  The reason for this is that JSP pages aren't meant for binary
output
> > (like a GIF image) -- but servlets can do this easily.
> >
> > An example of an Action to do this might look like this:
> >
> >   byte buffer[] = ... load byte array from the database ...
> >   int size = xxx; // Number of bytes to be sent
> >
> >   response.setContentLength(size);
> >   response.setContentType("image/gif");  // Or whatever is correct
> >   ServletOutputStream stream = response.getOutputStream();
> >   int sent = 0;
> >   while (sent < size) {
> >     int count = stream.write(buffer, sent, size - sent);
> >     sent += count;
> >   }
> >   stream.flush();
> >
> >   return (null);
> >
> > Note that NULL is returned, instead of an ActionForward.  This is the
> > signal to the controller servlet that the Action has already created the
> > response, so no forwarding is required.
> >
> > -----Original Message-----
> > From: Kuehnberger [mailto:Kuehnberger@web.de]
> > Sent: 16 October 2001 11:52
> > To: struts-user@jakarta.apache.org
> > Subject: ActionServlet return a pdf document
> >
> >
> > Hi,
> >
> > I'm using fop to generate a pdf document in a servlet.
> > Is it possbile for an ActionServlet to return that pdf document instead
> > of an ActionForward ?
> >
> > Jens
> >
> >
> >
> >
> >
>
***************************************************************************
> > This email message contains confidential information for the above
> addressee only.  If you are not the intended addressee you must not
disclose
> or use the information in any manner whatsoever.
> >
> > Any opinion or views contained in this email message are those of the
> sender, do not represent those of the Company in any way and reliance
should
> not be placed upon its contents.
> >
> > Unless otherwise stated this email message is not intended to be
> contractually binding.  Where an Agreement exists between our respective
> companies and there is conflict between the contents of this email message
> and the Agreement then the terms of that Agreement shall prevail.
> >
> > Abbey National Treasury Services plc. Registered in England. Registered
> Office:  Abbey House, Baker Street, London NW1 6XL.  Company Registration
> No: 2338548.  Regulated by the SFA
> >
>
***************************************************************************
> >
>
>
>
>
>
>
>


Mime
View raw message