File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Binary content from struts action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Binary content from struts action" Watch "Binary content from struts action" New topic
Author

Binary content from struts action

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2581

I have an action that generates response either as text or binary depending on the parameters passed to it. When it is a text response, it can easily be shown in the associated velocity templete (using VTL instead of JSP here) appropriately. However, I am wondering when the response is binary how would I send it to the client given that I am forwarding it to the velocity page.

I am thinking on these lines... let me know if this approach sounds fine --
When the response is text, it is forwarded to the regular VTL template, however when the response is binary, it will store that response in a request attribute and will forward to a servlet which will simply output that binary response. Is that fine?

TIA,
- Manish
[ November 17, 2005: Message edited by: Manish Hatwalne ]
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2581

Just for record -- I have tried and found that approach I have described works quite well. Just wondering if another better aproach to this?

- Manish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Binary content from struts action