Re: ServletOutputStream

2008-07-30 Thread Mike Rooney
Thank you for the help guys. I got it working. - Original Message From: Gabriel Belingueres <[EMAIL PROTECTED]> To: Struts Users Mailing List Sent: Wednesday, July 30, 2008 10:58:43 AM Subject: Re: ServletOutputStream A solution could be this: Store the excel data in session, t

Re: ServletOutputStream

2008-07-30 Thread Gabriel Belingueres
Original Message > From: Gabriel Belingueres <[EMAIL PROTECTED]> > To: Struts Users Mailing List > Sent: Wednesday, July 30, 2008 3:59:29 AM > Subject: Re: ServletOutputStream > > Your action can not generate two responses (if that's what you asking). > If you f

Re: ServletOutputStream

2008-07-30 Thread Miguel
ble to store the file data in a session and somehow have the File > Download dialog show up? If so I am not sure how to do that. > > > > - Original Message > From: Gabriel Belingueres <[EMAIL PROTECTED]> > To: Struts Users Mailing List > Sent: Wednesda

Re: ServletOutputStream

2008-07-30 Thread Mike Rooney
, July 30, 2008 3:59:29 AM Subject: Re: ServletOutputStream Your action can not generate two responses (if that's what you asking). If you forward to a 'status completed' page, then you need to save your excel data somewhere to not loosing it. 2008/7/29 Mike Rooney <[EMAIL

Re: ServletOutputStream

2008-07-30 Thread Gabriel Belingueres
t; HSSFSheet testSheet = wb.createSheet("TEST"); > ... > HttpServletResponse response = ServletActionContext.getResponse(); > response.setContentType("application/vnd.ms-excel"); > ServletOutputStream outstream = response.getOut

ServletOutputStream

2008-07-29 Thread Mike Rooney
ateSheet("TEST");     ...     HttpServletResponse response = ServletActionContext.getResponse();     response.setContentType("application/vnd.ms-excel");     ServletOutputStream outstream = response.getOutputStream();     wb.write(outstream);     outstream.flush();     respons

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
(DefaultActionInvocation.java:253) my getExcelStream looks like this public ServletOutputStream getExcelStream() { return this.stream; } excelDownload method has this that sets up the stream. stream = response.getOutputStream(); wb.write(stream); wb is the worksheet

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
gt; 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(\\\"Cont

Re: servletOutputStream in S2 action

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

servletOutputStream in S2 action

2008-02-07 Thread bhaarat Sharma
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\", \"attachmen