This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 2578

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: 2578

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Binary content from struts action
 
Similar Threads
how to send email using jsf
Error allocating a servlet instance
Ajax application response time
what is the value prop of Velocity
Help me eradicate xsl from my system