1

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.

LGAP
  • 2,365
  • 17
  • 50
  • 71

2 Answers2

2

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 :

Community
  • 1
  • 1
Colin Hebert
  • 91,525
  • 15
  • 160
  • 151
  • I really dont know how to handle such API and how it should be connected with the present jsp progrmam. please advise – LGAP Sep 07 '10 at 17:32
  • See resources and linked questions. – Colin Hebert Sep 07 '10 at 17:34
  • 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
    – LGAP Sep 07 '10 at 17:36
  • Updated, you should clarify your question. – Colin Hebert Sep 07 '10 at 17:42
  • I am a beginner and I am completely unaware of Servelet concepts. Is there any easier way to achieve the task? – LGAP Sep 07 '10 at 17:44
  • 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 Sep 07 '10 at 17:45
  • 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 Sep 07 '10 at 17:48
  • 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 Sep 07 '10 at 18:08
0

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

Hendra Jaya
  • 1,608
  • 11
  • 15