Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

apache pio?

 
Sam Doder
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSPs are not suitable for streaming binary data; use a servlet instead.
 
Sam Doder
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 213
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic