I have Tomcat5.5.9 installed in my computer. I am trying to set content type using Scriplet and Page directive as mentioned below. None of then works
Using Scriplet :
<% response.setContentType("application/vnd.ms-excel"); %>
<HTML>
<BODY>
<TABLE BORDER =2>
<TR><TH>first<TH>Last
<TR><TD>abc <TD>xyz
<TR><TD>mno <TD>qrs
</TABLE>
</BODY>
</HTML>
2 using page directive
<%@ page contentType = "application/vnd.ms-excel" %>
<HTML>
<BODY>
<TABLE BORDER =2>
<TR><TH>First<TH>Last
<TR><TD>abc <TD>xyz
<TR><TD>mno <TD>qrs
</TABLE>
</BODY>
</HTML>
But following code works fine
<HTML>
<BODY>
<%
String format=request.getParameter("format");
if (format!=null && "Excel".equals(format))
response.setContentType("application/vnd.ms-excel"); %>
<TABLE BORDER =2>
<TR><TH>First<TH>Last
<TR><TD>abc <TD>xyz
<TR><TD>mno <TD>qrs
</TABLE>
</BODY>
</HTML>
whats going wron here ?