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 PROTECTED]>:
> I created a small webapp that extracts data from a DB, creates an Excel file
> from that data (using Apache POI), which then streams the file to the end
> user's browser. Everything is working fine, however I have to set the Action
> class' return type to 'NULL' since I am setting the servlet response type to
> 'application/vnd-ms-excel'. I want to change my application so that it
> returns to a 'status completed' page when the extraction is completed.
> However I cannot do this when I set the return type is null. How can I do
> this?
>
> Here is my code...
>
> public class ExtractAction extends ActionSupport {
> public String execute() throws Exception {
> HSSFWorkbook wb = new HSSFWorkbook();
> HSSFSheet prodSheet = wb.createSheet("PROD");
> HSSFSheet devSheet = wb.createSheet("DEV");
> HSSFSheet testSheet = wb.createSheet("TEST");
> ...
> HttpServletResponse response = ServletActionContext.getResponse();
> response.setContentType("application/vnd.ms-excel");
> ServletOutputStream outstream = response.getOutputStream();
> wb.write(outstream);
> outstream.flush();
> response.flushBuffer();
> }
> return null;
> //return SUCCESS
> }
>
> and my struts.xml
>
> <struts>
>
> <constant name="struts.enable.DynamicMethodInvocation" value="false" />
> <constant name="struts.devMode" value="false" />
>
> <package name="default" extends="struts-default">
> <action name="Extractor" class="action.ExtractAction">
> <result name="success">/example/index.jsp</result>
> </action>
> </package>
>
> </struts>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]