tags:

views:

52

answers:

2

The end user will select an excel file on executing the below jsp program.

   <form action="?? " method="post" enctype="multipart/form-data" name="form1" id="form1"> 

    Upload File:
   <input name="file" type="file" id="file"><br><br>
   <input type="submit" name="Submit" value="Submit"/><br><br>
   <input type="reset" name="Reset" value="Reset"/>   
   </form>

The excel sheet will be in a specified format which need to be read and compared with the contents of Database.

My query here is how should I proceed with this once the user browses the excel file and submits the jsp form.

How the excel sheet can be invoked to a java program and please explain me the steps of doing the same. Am a beginner in java and I would be so thankful if your answer is self explanatory.

Thanks in advance.

+2  A: 

You can manipulate Excel documents with the Apache POI API.


Your action should redirect you to a servlet which will handle the file. You'll need to handle multipart files, you can use Apache file upload to do this.


Resources :

On the same topic :

Colin Hebert
I really dont know how to handle such API and how it should be connected with the present jsp progrmam. please advise
LGAP
See resources and linked questions.
Colin Hebert
yeah I will learn from those resources. But could you please let me know how to connect that program to my present jsp program. What must be given in <form action="" ?
LGAP
Updated, you should clarify your question.
Colin Hebert
I am a beginner and I am completely unaware of Servelet concepts. Is there any easier way to achieve the task?
LGAP
I'm afraid there is not. You really should look at all the links I gave (and the links in there), you'll find every information you need to do this.
Colin Hebert
I have written a Servelet program already which has a doPost(request, response) method in it. How to compile that Servelet program? Is there any unique way of compiling or it can be done as normal java program?
LGAP
What you need here, is to learn first how to do web applications in java. You should seek tutorials like this one : http://download.oracle.com/javaee/5/tutorial/doc/bnadp.html
Colin Hebert
A: 

Apache already invented a library to read excel sheet. Its name is Apache Poi. It's free and it's well documented. And of course a sample code is available

jancrot