Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

problem with download manager in IE browser.

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to display excel sheet values. i am getting illegalstateexception.

iam working on struts frame work.

the jsp page calls the action method


the action class contain method

public ActionForward createMemberExcel(ActionMapping m, ActionForm f, .........ponse) throws Exception{


{
retrieving data from databse

setting it to stream like this

byte[] blobdata1 = wb1.getBytes();
response.setContentType("application/vnd.ms-excel: xls, xlb: Microsoft Excel Document");
response.addHeader("Content-Disposition", "application; filename="+" MemberExcel"+".xls");
OutputStream out = response.getOutputStream();
int off = 0;
int l = (int) wb1.getBytes().length;
out.write(blobdata1, off, l);
out.flush();
out.close();
}
}


my code is working fine with mozilla browser but when iam using IE browser iam not getting file download manager. please give me your ideas to solve this problem. thanks
[ November 10, 2008: Message edited by: vijay akni kumar ]
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Is that it? Basically there are lot of basic coding problems in your code, like exception handling, not closing streams in the finally block etc. Let's keep them apart.

Basically, whst's happening is, this particular method, returns the action mapping. But by the time you reach there, you have already comitted the response by calling the out.write and flush. You can comit the outstrema only once. Hope you got it.

Cheers
Aneesh
 
We're being followed by intergalactic spies! Quick! Take this tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic