This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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

Reading in a *.csv file and loading the data

sharon christa

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

Joined: Jan 10, 2002
Posts: 60785

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

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
Vicky Vijay
Ranch Hand

Joined: Apr 23, 2008
Posts: 125

Please refer the below reference links,

Reference 1



Rob Spoor

Joined: Oct 27, 2005
Posts: 19654

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.

How To Ask Questions How To Answer Questions
Consider Paul's rocket mass heater.
subject: Reading in a *.csv file and loading the data
Similar Threads
UTF date formatting
Error in handling Unicode in java
CSV+truncate leading zero solution
Approach to validate objects in list
Select query with order by is not working on CSV file