Originally posted by Crystal Bazil:
I have a search function(JSP) which upon submit returns results to itself in a HTML table. I would like to give my users the ability to save the report in excel via button click.
From searching the forums, I have been able to piece together bits of how to do this. However, I am slightly confused on how to send the HTML section to printed.
fooTwo form calls a servlet:
In the above code, if I use the set tag around the HTML written the results will not display on JSP page. However, If I click the open excel button - the proper results are there. I realize this is because I am setting the html as the value of foo. But I need the results displayed on the JSP and then if needed in excel.
I have a feeling this is pretty dumb but I am stumped as to how I should do this. Any advice/direction would greatly be appreciated.
Thanks,
Crystal
Hi Crystal,
I have been working on transporting data out from a database to excel, which is kind of related to the question you are asking.
Firstly, i think
you should let us know what kind of framework you are using for your site..
Anyway, i reckon that to work around for your problem, you must either get an API to help out with. You can either use JExcel API(www.andykhan.com/jexcel) or POI, which is a package, to help you achieve the result of exporting the data into the Excel format. As for what i understand through my own experience, your solution should come in two parts.
Firstly, you should just populate the results out in the servlet. You can simply get a servlet to "talk" to the JSP and transport the data. Which means, under the MVC model, Control -> View layer...
Next, to exporting the data, you could just simply write an action(
Struts) class to support this functionality..
This is how you should split the classes.. do let me know if you need further help..