java - Upload Excel file to servlet and get data from it -


I am trying to upload an excel file in a sublet, get data about it, and then this data to the database Send. / P>

And I'm stuck in the very beginning: Uploading the file.

To get data from a file, I want to use Apache POI, and here is my code:

  System.out.println ("imported . Java"); Part filePart = request.getPart ("Import"); System.out.println ("File Part:" + FileParty); FileInputStream inputstream = (FileInputStream) filePart.getInputStream (); System.out.println ("inputstream:" + inputstream); Workbook book = workbook. Informer (Inputstream); Sheet Sheet = Book .getSheetAt (0); (Line row: sheet) {for (cell cell: row) {System.out.println ("row:" + row + ", cell value:" + cell.getRichStringCellValue (). GetString ()); }} Inputstream.close ();  

The output of this code is:

  entered import. Java file page: org.apache.catalina.core.ApplicationPart@bc6f13InputStream: java.io .FileInputStream @ 532048c5 servlet.service () for servlet with path [import] thrown by [/ management] thrown in [servlet execution Root exception with an exception] java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlOptions  

UI Part is the SPUI 5 Framework and

I saw and saw the thread, but it does not help me.

How do I get this servicelet to work?

You are missing a jar in your web application that contains the XmlOptions class.

See the following answers ().


Comments