my dog learned polymorphism*
The moose likes JSP and the fly likes Reading in a *.csv file and loading the data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Reading in a *.csv file and loading the data " Watch "Reading in a *.csv file and loading the data " New topic
Author

Reading in a *.csv file and loading the data

sharon christa
Greenhorn

Joined: Mar 01, 2012
Posts: 8
I would like to know any advice for creating a jsp program that will read in a *.csv file and load the data for further processing. I want to identify each attribute in it and the total rows present in it also. Please advice
Thank you sooo much in advance
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

That would be a horrible misuse of technology. JSP is intended to create HTML views, not to process data. Process the CSV in a servlet or other Java class, not a JSP.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Don't try to parse the CSV files in your code, use one of the libraries listed in the "Excel" section of http://www.coderanch.com/how-to/java/AccessingFileFormats
Vicky Vijay
Ranch Hand

Joined: Apr 23, 2008
Posts: 125

Please refer the below reference links,


Reference 1

Reference2

Reference3

Reference4
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

Please ignore those first two links. StringTokenizer and splitting Strings on commas is not a good approach to parsing CSV files. There is a lot more to them than just comma's; there's quoting of values which allows comma's inside values. The third link looks better, but I'd still go for an existing CSV parsing library.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading in a *.csv file and loading the data
 
Similar Threads
Error in handling Unicode in java
Select query with order by is not working on CSV file
Approach to validate objects in list
UTF date formatting
CSV+truncate leading zero solution