This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes Reading data from files like  txt file, doc,csv extensions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Reading data from files like  txt file, doc,csv extensions" Watch "Reading data from files like  txt file, doc,csv extensions" New topic
Author

Reading data from files like txt file, doc,csv extensions

Ranganath .S.Junpal
Ranch Hand

Joined: Jan 16, 2005
Posts: 52
Hi,
I just wanted to know how to get the data from the files such as
.txt file/excel file /.doc file /.csv file as an input and store it to store in the database in a JSP.
The scenario is as follows:-
a) The text file contains the questions and 4 Options
b) my web app should recognise the question and put it in the database and like wise the respective questions should be stored in the database..

So how to distinguish the question and options and the correct answers from the these files.. .txt file/excel file /.doc file /.csv file

Looking forward fo r your replies at the earliest.

Thank you
Ranganath.S
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41579
    
  54
That depends on the layout of the data in the file, doesn't it? Java can read any of these file types (for XLS and DOC, there's the Jakarta POI library), but that won't help you much if the file contents are not regular in some fashion.

Is your question about how to parse files that don't have a fixed layout, is it about reading different types of files, is it about storing data to a database, or is it actually about JSP (since this is the JSP forum) ?


Ping & DNS - my free Android networking tools app
Ranganath .S.Junpal
Ranch Hand

Joined: Jan 16, 2005
Posts: 52
Hi,

Firstly i would like to thank you for your reply.
As far as my question is concerned.. its about parsing the file.. and extracting the data ie(questions and options, correct answer) from the file of different extensions using a JSP page and uploading the same to the Database.
hope my question is clear now!! expecting your reply at earliest.

As you had mentioned about the POI Library , do let know like how it can help me to solve this..

Thank you
Ranganath.S
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41579
    
  54
Actually, your question is not clear. If it is about all of these points, you should outline what you have done so far, so that we can see where you are stuck, and try to help you get going again.

Jakarta POI is a library that can read and write Word and Excel files. Its web site goes into a lot of detail on that, and has a bunch of examples.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Reading data from files like txt file, doc,csv extensions