Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP-EXCEL save defualt in .xls extension, open excel with in the browser

 
ajay halmandge
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-----
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment;filename=\"" + date_num + "\"");
.....
here date_num variable is for name of file in terms of date string.

I am working with Mysql,jsp,excel,linux.The above code line works pefectly.And i am able to see the data in Excel sheet. But the problem is that ,The excel file is opening in the name like http://www.localhost/21.jsp?list=20051002?list=

When user wants to save the excel file,default will be (html*,htm*)...But the requirement is to save in .xls extension (Note: user should not go on to edit filename while saving it)

Point: I am not downloading the file from server, infact it is generated dynamically .... And displaying in the excel.

One more thing : I want to open excel file with in the explorer browser
any Idea. I have tried by replacing attachment with inline...but didnt work.

Help Me!!!

Thanks in Advance
 
Gerhard K Greyvenstein
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/*<---- start ---->*/
response.setHeader("Content-Disposition","attachment;filename=report.xls") ;
/*<---- end ---->*/

Change the above 'attachement' to 'inline' to produce

/*<---- start ---->*/
response.setHeader("Content-Disposition","inline;filename=report.xls") ;
/*<---- end ---->*/

This will show the report your generating within the web-page, although it is still just an Excel instance running within the web-page.

 
joseph prabhu
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The above code(report.jsp) is working fine when this is given in the action attribute of input.jsp.

when i try to include this report.jsp in some other jsp (output.jsp) excel file is not opening

what i have to do
 
srikanth nallapaneni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any suggestion if we would like download the data into a standard Template
 
Dima Chornyi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, you need something like this in your code:

Second, in explorer you go to Tools->Folder options->Data types->[.xls/.xlsx]->Advanced-> check "Open in same window" (Exact text may be different as i am on German Windows). This can also be set trough registry.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
arun sherwal,
Your post was moved to a new topic.
Let's try the Struts forum...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic