Upload+ read an excel file in a jsp using POI

前端 未结 2 1573
不思量自难忘°
不思量自难忘° 2020-12-17 23:48

I want to read an excel file in JSP,for this I first uploaded the file in a folder in the :D partition named uploads using a web application project,and I t

2条回答
  •  攒了一身酷
    2020-12-17 23:52

    after item.write(f); add this

    InputStream inputStream= new ByteArrayInputStream(IOUtils.toByteArray(new FileInputStream(f)));
    
    Workbook wb = WorkbookFactory.create(inputStream);
    Sheet mySheet = wb.getSheetAt(0);
    Iterator rowIter = mySheet.rowIterator();
    rowIter.next();
    

    continue your code from here.

提交回复
热议问题