• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic