Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

The IE and Netscape conflict again!! :-)

 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a requirement of showing a dynamically generated data from database in Excel Format ,NOT as html page. It was back of my mind how I am going to do like that. Recently I bought the 'Core Servlet Programming' servlet book by Marty Hall. In that I got a solution like when we set the response contentType header as 'application/***the_registerd_appln_type' when the response is sent to the browser , the browser will open with the corresponding application.
Well, I was happy I got a solution. The MS-Excel appn. will be in all my users m/c. But when I tested with Netscape and IE, ONLY netscape asks us to open with Excel s/w while IE just displays as a html file. I can't force the users to use Netscape all the times. This is the problem. Is there any SPECIAL setup we need to do for IE to open with Excel appln? I did check but couldn't see any. Please take a look at this link in my appln which I tested with online. Try to goto this link through Netscape and IE.
http://www.webappcabaret.com/maha/Login/misExcel1.jsp
[Marty Hall DOES warn about this conflict when he talked about when setting the response content type as "text/plain", IE does not show as plain, instead it shows as html file though. ]
Can anybody give a solution to this? Basically what I need is the user should be able to SAVE the result from the database as an Excel file in his/her machine. The .jsp file's content is like below.
Thanks a lot.
regds
maha anna


[This message has been edited by maha anna (edited October 11, 2000).]
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using application/msexcel instead as the mime-type.
This is in line with the mime-type for MS Word. If it works, it should open Excel with the file inside the browser window in IE, what it does in Netscape is anybody's guess
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I recall, you have settings in the browser as to which data types it will recognize. Maybe your MSIE just doesn't have the right settings.
Bill
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeroen Wenting and Bill. Both Netscape and IE are opening with Excel now. I didn't set anything new. Yet to explore the settings in IE and Jeroen's tip.
regds
maha anna
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I get the code for this file misExcel1.jsp --
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!,
I have tried a lot of things to do that. But there are many options and you can try all of them.
here they are:
in the JSP at the top ...
<%@ page contentType="application/vnd.ms-excel" %>
<% response.setHeader("Content-Type","application/vnd.ms-excel");%>
<% response.setContentType("application/vnd.ms-excel");%>
In the <head></head> tag of the html use a meta tag..
<meta http-equiv="Content-Type" content="application/x-msexcel; charset=ISO-8859-1">

I have tried them and it works beautifully on both browsers.

Originally posted by maha anna:
[B]Hi,
I have a requirement of showing a dynamically generated data from database in Excel Format ,NOT as html page. It was back of my mind how I am going to do like that. Recently I bought the 'Core Servlet Programming' servlet book by Marty Hall. In that I got a solution like when we set the response contentType header as 'application/***the_registerd_appln_type' when the response is sent to the browser , the browser will open with the corresponding application.
Well, I was happy I got a solution. The MS-Excel appn. will be in all my users m/c. But when I tested with Netscape and IE, ONLY netscape asks us to open with Excel s/w while IE just displays as a html file. I can't force the users to use Netscape all the times. This is the problem. Is there any SPECIAL setup we need to do for IE to open with Excel appln? I did check but couldn't see any. Please take a look at this link in my appln which I tested with online. Try to goto this link through Netscape and IE.
http://www.webappcabaret.com/maha/Login/misExcel1.jsp
[Marty Hall DOES warn about this conflict when he talked about when setting the response content type as "text/plain", IE does not show as plain, instead it shows as html file though. ]
Can anybody give a solution to this? Basically what I need is the user should be able to SAVE the result from the database as an Excel file in his/her machine. The .jsp file's content is like below.
Thanks a lot.
regds
maha anna


[This message has been edited by maha anna (edited October 11, 2000).][/B]



------------------
Vikas Aggarwal
Technology Associate
Shakun Global Networks
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maha,
can I save the excel report from repsonse object on server side?
 
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The intermitency of the problem could have been related to cacheing since you didn't do anything, but the problem went away. This leads me to believe you had an old "cached version" and it didn't get reloaded until later.
Regards,
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
I could output data to an excel file. But, the requirement i have is, i need to output 2 different sets of data to 2 worksheets of the same excel file. How do i achieve this? Currently i am using the following code:
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition","attachment;filename=_search_results.xls");
Bharat
 
It's never done THAT before. Explain it to me tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic