• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

apache pio?

 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 213
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic