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
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
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
, 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
t; HSSFSheet testSheet = wb.createSheet("TEST");
> ...
> HttpServletResponse response = ServletActionContext.getResponse();
> response.setContentType("application/vnd.ms-excel");
> ServletOutputStream outstream = response.getOut
ateSheet("TEST");
...
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("application/vnd.ms-excel");
ServletOutputStream outstream = response.getOutputStream();
wb.write(outstream);
outstream.flush();
respons
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.
>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
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
(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
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
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
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
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: [
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
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
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);
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
18 matches
Mail list logo