Hi am trying to upload a excel sheet and parse the every columns and needs to save the columns in different tables for that am using jsp and servlet coding,in servlet coding am using apache POI for uploading, and i can able to upload the excel sheet but i cant parse the column values because encrypted values only i can able to get,
Here is my JSP code,
and my servlet code,
Please give me suggestions ASAP.
Thanks in advance.
Regards,
Suganth A
Here is my JSP code,
Code:
<TITLE>Display file upload form to the user</TITLE></HEAD> <BODY> <FORM ENCTYPE="multipart/form-data" ACTION="uploadExcel" METHOD=POST> <br><br><br> <tr><td colspan="2" align="center"> </td></tr> <tr><td colspan="2" align="center"><input type="submit" value="Send File"> </td></tr> <table>
Code:
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletContext servletContext = this.getServletConfig().getServletContext();
File repository = (File) servletContext.getAttribute("javax.servlet.context.tempdir");
factory.setRepository(repository);
ServletFileUpload upload = new ServletFileUpload(factory);
try {
@SuppressWarnings("unchecked")
List<FileItem> items = upload.parseRequest(request);
Iterator<FileItem> iter = items.iterator();
while (iter.hasNext()) {
FileItem item = iter.next();
}
} catch (FileUploadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Thanks in advance.
Regards,
Suganth A
Comment