I'm very new to servlets/jsp but have a strong java background. This is what I want to do: 1. Take input from an html page 2. Use this input to generate a sql query to the database. 3. Depending on user input output an html table or an excel table. I don't have any problems with 1 or 2 or generating the html table. I've also successfully constructed an excel table (via jakarta POI, which is awesome btw) but I'm not sure how to display it. As I said I'm extremely new to servlets and I don't really know how to redirect to an excel document. I constructed the excel doc and have saved it on the webserver. What commands should I use to redirect to this document (it's within the same webapp as the servlet). Any help would be greatly appreciated. Thanks, Michael Crutcher Texas A&M University
If you really need to have the file, you could include a link to it in the HTML page you send as a response to the user's input, of course the file would have to be placed where it could "legally" be served like any other file with a link. Alternately you could use a link that pointed to your servlet and have the servlet send the file, that way the file could be anywhere. Or you could create the file and serve it on the fly. You would have to get the content type right so the browser would know what to do with it. I think there were more discussions of this around here recently. Bill
Hi, The trick is simply to stream it back to the browser and set the content-type to be application/vnd.ms-excel. That way it should be picked up and displayed in Excel in the browser. Note also that you can stream an HTML table with that content type and have that table displayed in Excel, which removes the need for POI depending on how complex the spreadsheet is.
---<br />Time flies like an arrow,<br />Fruit flies like a banana
Joined: Feb 18, 2002
Thanks for your quick response. I'm going to just send back a link to the page for now. (that was to obvious for me to think of) I'd like to just pop it up, but I think I need to learn more first. Thanks, Michael Crutcher Texas A&M University