Well i guess thats technically correct but arguably if my action is delegating control flow by validating the user is who he says he is before showing the pdf to him. He can be bounced to 3 other screens via this action class and I don't see much difference in using the action to stream back response or creating a byte[] or refernce to the File and storing in request scope.
Ive achieved reuse by dumping a modified version of Nick's handy method in a utility class that I'll be reusing on other projects. So while i agree with you on principle, i think this might be one of those cases where in practice its a better idea to stray from stringent mvc pattern. But I'm just a hack. :) -B -----Original Message----- From: Andre Van Klaveren [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 26, 2005 4:51 PM To: Struts Users Mailing List; Nick Heudecker Subject: Re: PDF Streamed To Client Brian, While Nick's solution certainly works, it doesn't follow best practices, MVC in particular (No offense Nick). Technically a view component such as a Servlet or JSP should be responsible for writing the response back to the client. The Action is responsible for flow control and interacting with business components. I solved a similar problem by having the Action place a byte array of the PDF content and the content type (as a String) in request scope and forwarding to a Servlet. The Servlet's (called BinaryOutputServlet) sole purpose is to retrieve the content and content type from request scope and stream it back to the client. This is where Nick's example code would fit nicely. Now, in your case you would probably put a reference to the PDF file in request scope instead of a byte array, especially if the PDF documents are large. In my case the content was relatively small and was generated dynamically. If you design the Servlet generically it can be reused in any project that requires the application to stream the content of any type of file to the client (gif, jpg, rdf, etc). -- Virtually, Andre Van Klaveren SCP --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]