I am exporting data to an Excel sheet in JSP.
<%@page import="java.io.*"%> <%@page import="org.apache.poi.hssf.usermodel.HSSFSheet"%> <%@page import="org.apache.poi.hssf.usermodel.HSSFWorkbook"%> <%@page import="org.apache.poi.hssf.usermodel.HSSFRow"%> <%@page import="org.apache.poi.hssf.usermodel.HSSFCell"%> <% String inj1=request.getParameter("inj"); String ob=request.getParameter("ob"); HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("Excel Sheet"); HSSFRow rowhead = sheet.createRow((short)0); rowhead.createCell((short)0).setCellValue("Injections"); rowhead.createCell((short)1).setCellValue("OB"); HSSFRow row = sheet.createRow((short)1); row.createCell((short)0).setCellValue(inj1); row.createCell((short)1).setCellValue(ob); FileOutputStream fileOut = new FileOutputStream("c:\\Injection_Details.xls"); wb.write(fileOut); fileOut.close(); out.println("Data is saved in excel file."); %> I am getting errors as
HSSFWorkbook cannot be resolved to a type
or
Only a type can be imported. org.apache.poi.hssf.usermodel.HSSFSheet resolves to a package.
How is this caused and how can I solve it?