• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

problem in headers and content types

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my web application aim is to download the data from mysql to excel sheet . but using internet explorer browser if iam downloading the data to excel sheet iam able to download the empty excel sheet ie,, iam not able to see the data.
but the same application if iam using mozilla firefox browser iam able to download the excel sheet with data.
i want to download the data by using both browsers.

iam displaying the headers and content types

response.reset();
byte[] blobdata1 = wb1.getBytes();
response.setContentType("application/vnd.ms-excel: xls, xlb: Microsoft Excel Document");
response.setHeader("Content-Disposition", "inline; filename="+" Excel123"+".xls");
response.setDateHeader("max-age", 0);
response.setHeader("cache-control", "no-cache");
response.setHeader("Content-Encoding", "en-US");
response.setHeader("Connection", "keep-alive");
response.setHeader("Expires", "0");
response.setHeader("Pragma", "no-cache");
OutputStream out = response.getOutputStream();
int off = 0;
int l = (int) wb1.getBytes().length;
out.write(blobdata1, off, l);
out.flush();
out.close();

Needed suggestions
 
Sheriff
Posts: 67753
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ain't too sure, but you could try setting the following for the Content-type header and see if it works:

application/msexcel
application/x-msexcel
application/ms-excel

Browsers have a weird way of being touchy about what one sets for the Content-type header.
Also as I see, you haven't set the Content-length header. Set it to the value of blobdata1.length
 
What? What, what, what? What what tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic