Bear Bibeault wrote:You're going about it all wrong. You can't use normal Java file I/O to read a file on the client from code running on the server.
Please see the ServletsFaq and JspFaq for information on file uploading. You need to use HTTP, not file I/O.
Ulf Dittmer wrote:Be aware that that code only works for XLS files, not XLSX files. If you want something that works for both files, you should use the org.apache.poi.ss.... packages instead of the org.apachepoi.hssf... packages; the code shouldn't be hard to refactor.
Ulf Dittmer wrote:
Niraj Jha wrote:Check documentation:
Why do you recommend the low level API? POI has perfectly fine high level APIs.
But let's take a step back: You said you need to import data from Excel, and then print it. So what do you mean by "I am using the POI library for exporting data." - what is the "export" step that you already have?
But regardless, the POI web site has many, many code examples for doing just about anything related to XLS and XLSX files.
Akhilesh Trivedi wrote:This looks too complicated, because your database, your view and your control-logic all are in one place. Why not have JSP separately and send/receive data via session/request objects.