My jsp page contains a button which exports data to an excel sheet. The excel file is being saved on the server. How can i save the file directly on the client. [ June 16, 2005: Message edited by: Ankit Pedro ]
You cannot save it directly to the client. Think of the nightmare that would ensue if every server could just write whatever it wanted to your computer.
The viable approach is to offer the report for download. If the file exists on the server in a place accessible to the web server, this could be as simple as creating a link (using the <a> tag) to that file.
Otherwise, you could write a servlet that streams the file to the client after setting the correct content and disposition headers.
Set the content type (to tell the browser what kind of file this is).
Set the content disposition (to tell the browser what the name of the file is to be and whether to prompt for a location to save to 'attachment' or to open the associated application 'Excel' right in the browser 'inline'.
Then parse your data into delimited lines or an HTML Table). [ June 17, 2005: Message edited by: Ben Souther ]