aspose file tools*
The moose likes Other Open Source Projects and the fly likes apache pio? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "apache pio?" Watch "apache pio?" New topic
Author

apache pio?

Sam Doder
Ranch Hand

Joined: Feb 06, 2008
Posts: 204
The below code works fine but when I try to add response.getOutputStream and pass this to wb.write so that when somebody goes to the jsp page it will popup a dialog box for them to download the excel spreadsheet automatically. The problem is I cann't use printWriter and outputstream at the same time....





Thanks for any help
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
JSPs are not suitable for streaming binary data; use a servlet instead.


Ping & DNS - updated with new look and Ping home screen widget
Sam Doder
Ranch Hand

Joined: Feb 06, 2008
Posts: 204
OK , I also have this servlet. That seems to popup the download .xls box put when you download it and open it... it say's that the data is corropt or not in the correct format.

What is going wrong




If I use FileOutputStream instead it creates the file in the C:\workbook.xls.... but I want it to not create it but physically popup a download box so the person can download it/save/open it anywhere he wants.

What is going wrong with OutputStream out = response.getOutputStream();


Thanks for any help.... The apache pio stuff seems to work fine in regular java projects but a dynamic web project using jsp and servlets is where it is not working as well.
Richard Golebiowski
Ranch Hand

Joined: May 05, 2010
Posts: 213

it say's that the data is corropt or not in the correct format.


I have found that when I get this message that it means just what it says. If you are using MS Excel then try opening the downloaded file with OpenOffice Calc. I have found that sometimes I have problems Excel but not in Calc. You could also try changing or simplifying your test spread sheet even more to see if that makes a difference.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
The GET method doesn't do anything useful (it returns nothing to the browser). Is the error message happening when you're doing a POST?

By the way, you should never have a constructor in a servlet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: apache pio?
 
Similar Threads
Generate Excel report in java
excel
Save File on Client Machine
how to extract data to an xl sheet
streaming excel files on ServletOutputStream