• 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

Tabular Data

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Landon, is this a web-application?
 
Landon Blake
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yah, this would have been better in the Java In General - Intermediate forum (or even Swing).
reply
    Bookmark Topic Watch Topic
  • New Topic