This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tabular Data

 
Landon Blake
Ranch Hand
Posts: 121
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 121
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Landon, is this a web-application?
 
Landon Blake
Ranch Hand
Posts: 121
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic