Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a CSV file and storing it into an array and then displaying it on a HTML screen  RSS feed

 
Shantanu Rathore
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

Requirement: TO read a CSV file and transferring the content into an array which I can display on a JSP/HTML screen.

Description:-
1. I want to read a CSV file stored in a particular location on my computer.
2. As per my understanding, the CSV file is a comma separated file with each line representing a row in a table. The columns are separated by commas.
3. I want to store the CSV file contents in an array in exactly the same structure as the original tabular format.
4. Then I want to display the file on a JSP screen or a HTML screen in tabular format again.

Notes:-
The CSV file I have is a pretty big one because it has a lot of data. The data is mostly 'string'.

Since this is the first time I am trying something like this I dont have any idea about the code. Can anyone help me out with a small example explaining me how to go about doing this?

Thank you all in advance. Eagerly awaiting a response. Thanks

Shantanu
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This kind of thing should not be done in a JSP, but in a backing bean or servlet. The http://faq.javaranch.com/java/AccessingFileFormats points to various libraries that can read CSV files.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this article for information on properly structuring web apps.
 
Shantanu Rathore
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Ulf: Thanks. I ll keep it in mind to code the part in a java file. Thanks for pointing out the libraries to read CSV files.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!