Try adding out.clear() right before changing content type.  Like this:

<%
out.clear();
response.setContentType("application/vnd.ms-excel");
%>

-----Original Message-----
From: yanming lu [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 06, 2002 11:45 AM
To: [EMAIL PROTECTED]
Subject: Re: struts and excel


Could you show me what is wrong in the following code?
-----------------------------------------
<%
response.setContentType("application/vnd.ms-excel");
%>
<html>
<head><title>Excel-Export</title></head>
<body>
<table>
<tr>
<td>1997</td>
<td>2000</td>
<td>1999</td>
</tr>
<tr>
<td>12.3</td>
<td>13.4</td>
<td>15.6</td>
</tr>
</table>
</body>
</html>
--------------------------------------------------
This displays the file as HTML page instead of opening an excel file.


>From: "Roy Truelove" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Subject: Re: struts and excel
>Date: Thu, 6 Jun 2002 11:37:04 -0400
>
>Struts has nothing builtin for this (as far as I know).  Excel can read
>HTML
>tables however, so if your JSP's create a standard <TABLE>, and you set
>your
>content type :
>
>response.setContentType("application/vnd.ms-excel");
>
>the browser should know to open it with Excel.
>
>Take it easy,
>Roy
>
>----- Original Message -----
>From: "yanming lu" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Thursday, June 06, 2002 11:00 AM
>Subject: struts and excel
>
>
> > How to display an excel file in struts?
> >
> > _________________________________________________________________
> > MSN Photos is the easiest way to share and print your photos:
> > http://photos.msn.com/support/worldwide.aspx
> >
> >
> > --
> > To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to