• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

How to read the data in CSV file and display it in Drop down list box in JSP

 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,
I have a csv file.For example which should be like
Issue.csv

Number Issue
1 Technical Problem
2 Suggestion on Site
3 Statement Request

I want to read this file(issue.csv) and display the the content of 'Issue' in my JSP page drop down list box let say 'Subject of Issue'

Could you please tell me how to write the code for this thing in my jsp page.

Thanks a lot in Advance.

Regards
Sumanta Panda
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by sumanta panda:

Could you please tell me how to write the code for this thing in my jsp page.



It's not a good practice to write Java Code in JSP file, though you can do that !

Try to implement following steps,

Read a file, parse it , use bean & write the bean data in <select><option value="write bean data"></select>

So lets start, and ask If you stuck in between !!

 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
APACHE POI, a Parser Utility, would be a good place to start
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apache POI can read XLS files, but not CSV files.

The http://faq.javaranch.com/java/AccessingFileFormats page lists several libraries that can read CSV files (and I recommend that you use a library - CSV is not as simple a format as it looks at first).
[ November 18, 2008: Message edited by: Ulf Dittmer ]
 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Sagar Sir,
I am very poor in cooding to write this component in java.Could you please give me some idea or send me the source code how to write it.

Thanks a lot in Advance.

Best Regards
Sumanta Panda
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sumanata,

What have you tried so far? It's JavaRanch policy not to just 'hand out code' but to try and guide people with their own efforts. People learn much better that way
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic