Gopal,
Generally you should n't use JSPs for returning non html content.
I will try to give you some brief pointers. I assume you have a web application in
which you need to create an excel file dynamically and send it to the browser.
In you page you will have a button on click of which you can call a servlet called
ExcelDownloadServlet.
In the doGet method of the servlet you can add the code that you have in the
jsptoExcel method. This will return the excel file to the browser.
-Rahul
--- ORIGINAL MESSAGE ---
From:[EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject:Need help
Date: 04/08/2004 05:22:55 AM
Hi Friends,
I want to send the contents of html page(jsp) to excel file.
This I want to happen on the click of the button.
I have written a function name
function jspToExcel()
{
<%
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet();
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment;filename=gopal.xls");
OutputStream output = response.getOutputStream();
wb.write(output);
out.close();
return;
%>
}
and I am calling this function on button click.
But when I try to execute the jsp page I get "Compilation Error"
If i remove "return " statement, I get illegalStateException.
Pl . help me where I am wrong.
As I have seen the others mail, I have tried to follow same thing.I have
included all library.
with regards
Gopal
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
The problem with designing something completley foolproof is to underestimate the
ingenuity of a complete fool - Douglas Adams
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]