Search in This Blog

Generate CSV in jsp without third party utility

Generate CSV in jsp without third party utility

There are lot of third party paid and free utility that generate CSV file in JSP/Java. but the problems are to hard to implement. and may utility first create CSV file in the server, so Server space will be consumed.
To overcome all the problem I have created listed below the code. You are free to use it in you project.

<%@ page import="java.util.ArrayList"%>
// the session.getAttribute("listResult") is containg of comma sepearte multiple lines as listed below

ArrayList<String> list = (ArrayList<String>)session.getAttribute("listResult");
out.println("<table border='1'>");
for(int i = 0; i < list.size(); i++) {
    String myString = (String)list.get(i);