-3

I have CSV page and I want read all columns contains CSV file and display in JSP page I am using following code:

        br = new BufferedReader(new FileReader(csvFile));

        while ((line = br.readLine()) != null) {

            String[] country = line.split(cvsSplitBy);
             wordList = Arrays.asList(country);
            //System.out.println("data is"+wordList.size());

        }

How to display ArrayList in JSP page using struts with display tags.

I am not able to write setter methods of properties because I do not know a CSV file contained how many columns in it as it changes file to file

Ocracoke
  • 1,718
  • 3
  • 24
  • 38
Mohammed haneef
  • 127
  • 2
  • 10

1 Answers1

0

From what I have understood from your post is that you have the array list of strings and you cannot display it in JSP. Is this what you want? A quick solution can be to create a new String from that list, and display just a String.

aurelius
  • 3,946
  • 7
  • 40
  • 73
  • my csv file contains following data fname,lname,address,city,state,country,zip how this can be display – Mohammed haneef Nov 14 '14 at 15:53
  • well, you have 3 posibilities: 1. jsf 2. scriplet (if you just wanna use the standard JSP library), you use a scriplet to iterate over the list, and output the fields in what manner you want 3. my sugestion above, create a string in which you add a separator after each field, you display this string in the jsp in a div or some tag, and the you use a javascript function to parse and display it in your choosing. – aurelius Nov 15 '14 at 08:30
  • scriplet: http://stackoverflow.com/questions/20789207/iterating-through-a-list-object-in-jsp – aurelius Nov 17 '14 at 08:51
  • jsf+richfaces: http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?c=column – aurelius Nov 17 '14 at 08:52