Re: [struts] servletOutputStream in S2 action

2008-02-07 Thread Dale Newfield
bhaarat Sharma wrote: What you need to do is provide the result with a source of the >data to be sent to the client. and that data has to be in java.io.InputStream?? An InputStream is a source of data. An OutputStream is a destination for data. even if my getExcelStream method returns java.

Re: [struts] servletOutputStream in S2 action

2008-02-07 Thread bhaarat Sharma
>What you need to do is provide the result with a source of the >data to be sent to the client. and that data has to be in java.io.InputStream?? even if my getExcelStream method returns java.io.OutputStream...I still get an exception so what TYPE of data should getExcelStream be returning :( se

Re: [struts] servletOutputStream in S2 action

2008-02-07 Thread Dale Newfield
bhaarat Sharma wrote: Thanks for that. that gives me a better idea to go about things + i didnt know we can call methods from struts.xml http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/dispatcher/StreamResult.html describes how that result works, stating taht the "inputNam

Re: [struts] servletOutputStream in S2 action

2008-02-07 Thread bhaarat Sharma
Thanks for that. that gives me a better idea to go about things + i didnt know we can call methods from struts.xml i implemented this but am getting this error java.lang.ClassCastException: org.apache.coyote.tomcat5.CoyoteOutputStream org.apache.struts2.dispatcher.StreamResult.doExecute

Re: [struts] servletOutputStream in S2 action

2008-02-07 Thread Dale Newfield
bhaarat Sharma wrote: I think its better if i post some code. This is the action mapping for /useradmin/AccessRequestReport.jsp login.jsp application/vnd.ms-excel excelStream name="contentDisposition">attachment;filename="${excelFilename}" 102

Re: [struts] servletOutputStream in S2 action

2008-02-07 Thread bhaarat Sharma
I think its better if i post some code. This is the action mapping for /useradmin/AccessRequestReport.jsp login.jsp this is my execute method: public String execute() throws IOException, ServletException { //we dont enter here for excel if (getServlet

Re: [struts] servletOutputStream in S2 action

2008-02-07 Thread Dale Newfield
bhaarat Sharma wrote: ..what should my execute method be returning? As always, it should return the name of the appropriate result (in this case, the name of the result of type "stream"). -Dale - To unsubscribe, e-mail: [EM

Re: servletOutputStream in S2 action

2008-02-07 Thread bhaarat Sharma
just read the link you sent. I cant make my execute method void because it is being used for another page which requires it to send something back. :( - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

Re: [struts] servletOutputStream in S2 action

2008-02-07 Thread Dale Newfield
Mike Jennings wrote: You can do this by creating a custom result type. Or you can use a result type that's already provided that does exactly what you need. http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/dispatcher/StreamResult.html How can i do the same in my execute

Re: servletOutputStream in S2 action

2008-02-07 Thread bhaarat Sharma
I was trying stuff out and i hve got it working perfectly. Only thing is my that my execute is returning a SUCCESS when everything is done. However I do not have any in my struts.xml for this action. since the user shouldnt be moved to another page. Now I am able to see open /save dialog box as

Re: servletOutputStream in S2 action

2008-02-07 Thread Mike Jennings
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 examp

servletOutputStream in S2 action

2008-02-07 Thread bhaarat Sharma
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