0

I need to export a data in jsp page(i.e in a webpage) to a .CSV file onclick of a button.

Can someone help me on how to code?

user3622196
  • 71
  • 3
  • 16
  • See this previous question http://stackoverflow.com/questions/13159272/how-to-export-data-in-csv-format-using-java – dalyc May 21 '14 at 23:03
  • Hi thanks. I want to do it from a client side .ie. just the data in the jsp to a csv file and not at the servlet level. I have 2 jsp files. 1.Already has a table and i need to export that to a csv file 2.It just has one column and i need to export to csv file. – user3622196 May 21 '14 at 23:08
  • Can someone help me on this?I included the below code <%response.reset(); response.setHeader("Content-type","application/csv"); response.setHeader("Content-disposition","inline; filename=test.csv"); %> This opens the excel sheet with all the jsp tags (entire code in jsp) and does not display the data in columns. – user3622196 May 22 '14 at 16:22
  • If I click on a button it should export to csv. i give this in the jsp page input type="button" name="export" value="Export to .CSV File" onclick="ExporttoCSV()"> I have a function that does export to csv like this. But this function is not being called when i click the button. Any thoughts on where I am going wrong.Pls help me. – user3622196 May 23 '14 at 16:43
  • This is the easiest way to do..That is at the server side. http://stackoverflow.com/questions/23836728/how-to-export-the-data-in-a-list-to-a-csv-file-in-the-server-side – user3622196 Jun 05 '14 at 16:50

1 Answers1

0

You need to use the JDBC connectivity for this. Please refer to the below doc. https://www.roseindia.net/jsp/jdbccsv.shtml

Siddharth
  • 141
  • 4
  • 16