You can do this by creating a custom result type.
A example of a custom result type for streaming images from a action to
a img tag is here.
http://struts.apache.org/2.x/docs/how-can-we-display-dynamic-or-static-images-that-can-be-provided-as-an-array-of-bytes.html
You can use this as a example, but will probably have to have a modify
it slightly so that your action will have a getter and setter to pass a
output stream to the result type. In the result type you can write the
output stream to the response output stream.
Mike Jennings
bhaarat Sharma wrote:
Hello
I have a S2 action working perfectly fine. But on one page of my web
App I would like the user to be able to download report in Excel. We
have this functionality in other pages as well but they arent using S2
and are doing this via a custom servlet which has doGet doPost and
processRequest methods.
Inside the processRequest..they do bunch of stuff to get the excel
read and in the end do this:
ServletOutputStream stream = null;
String fileName = \"something\";
response.addHeader(\"Content-Disposition\", \"attachment;
filename=\" + fileName);
response.setContentType(\"application/vnd.ms-excel\");
stream = response.getOutputStream();
wb.write(stream);
this is a void method.
My question is, since in my case I already have a S2 action..I dont
want to make a new servlet to do this.
How can i do the same in my execute method for S2?? what should the
execute method return? because when user clicks get Excel link..the
page stays the same but just the user is presented with open/save
dialog.
Woudl appreciate any help.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------
Spam/Virus scanning by CanIt Pro
For more information see
http://www.kgbinternet.com/SpamFilter.htm
To control your spam filter, log in at
http://filter.kgbinternet.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]