Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
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
 
Rancher
Posts: 43016
76
  • 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.
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic