This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes Tabular Data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Tabular Data" Watch "Tabular Data" New topic
Author

Tabular Data

Landon Blake
Ranch Hand

Joined: Dec 04, 2003
Posts: 121
I brainstorming a simple application that will need to import, export and display tabular data, most likely in a .csv format. The program will modify some of the values in the tabular data. What is the best approach to this? Should I try to use the Swing jtable class? Or is there another better method?
Thanks,
The Sunburned Surveyor
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
Originally posted by Landon Blake:
I brainstorming a simple application that will need to import, export and display tabular data, most likely in a .csv format. The program will modify some of the values in the tabular data. What is the best approach to this? Should I try to use the Swing jtable class? Or is there another better method?
Thanks,
The Sunburned Surveyor

Welcome to javaranch Landon
have a look at DisplayTag. Not sure if this is what you're after, or if it fullfils your requirements, but it's worth having a look at it.. I'm also not sure on how you can use JTable in servlet/jsp. I thought that was the reason Sun came up with the "new" specification for JavaServer Faces...
anyways, hope it helps
[ December 04, 2003: Message edited by: Andres Gonzalez ]

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

There's at least one open-source package that might help.

jakarta.apache.org/poi

I'm actually in the middle of developing an 'excel upload & parse' web app with this package.

I upload (with com.oreilly.servlet) and then parse the file using HSSF (from POI).

There's also this much simpler API, which I've also used to good effect to produce simple CSV files of a database query.

http://ostermiller.org/utils/CSV.html

Hope those help.
Nehul NN
Ranch Hand

Joined: Nov 05, 2003
Posts: 45
You can parse csv file & get values into arrays or vector. After that Swing (JTable) classes can use array or vector to display entire content. You can edit, delete or modify JTable column. When you press save button entire JTable data will be formatted back in csv file. (you can just read rows & put , after every column values).
Hope I understand your idea & made right solution.
Landon Blake
Ranch Hand

Joined: Dec 04, 2003
Posts: 121
Thanks for the tips everyone. I think Nehul was able to understand my thoughts the best, I think his solution will work. But what does it mean to "parse the .csv file"?
Thanks again for your help.
Nehul NN
Ranch Hand

Joined: Nov 05, 2003
Posts: 45
I mean to say your csv file is ", separated". So you have to read your csv file line by line. After that take every line & parse it for ",". You can do that using "split" method of string because every line from csv file can be store as a string.
Hope this help.
SCJP1.4
SCWCD
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Landon, is this a web-application?
Landon Blake
Ranch Hand

Joined: Dec 04, 2003
Posts: 121
Mike,
No this is not a web application. It is a stand alone program that will convert tabular data to GML and SVG format. My appologies if I got posted to the wrong board.
Thanks,
Landon
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

yah, this would have been better in the Java In General - Intermediate forum (or even Swing).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tabular Data