Hey, try the code in the servlet or in the JSP. This converts a simple excel sheet on which you can perform further operations.
response.setContentType("application/vnd.ms-excel"); PrintWriter out = response.getWriter(); try { out.println("\tId \tName"); out.println("\t1\tabc"); out.println("\t2\txyz"); out.println("\t3\tpqr"); } finally { out.close(); }
here.
response.setContentType("application/vnd.ms-excel");
specify the excel sheet to be generated. all "\ t" separate the new cell in the excel sheet.
At your request, you can also change this code using a database or any ...
source share