Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Not able to complie JSP file.

Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have the following code in my jsp , when i try to execute it , i get an exception in tomcat that it was not able to compile it as
it was not able to resolve the class name or Type:
HSSFWorkbook ,HSSFRow , HSSFCell and POIFSFileSystem
I have these files in my build path (class path) and i can execute the code below (exactly same) if i execute it in a java class instead of jsp.
it runs and gives me the result as well, but in scriptlet it does not.
what am i doing wrong?

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<%@page import="*,org.apache.poi.hssf.usermodel.*,org.apache.poi.poifs.filesystem.*" %>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

FileInputStream fileIn = null;
FileOutputStream fileOut = null;

fileIn = new FileInputStream("c:\\MYEXCEL.xls");
org.apache.poi.poifs.filesystem.POIFSFileSystem fs = new POIFSFileSystem(fileIn);
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
int NO_OF_ROWS=sheet.getPhysicalNumberOfRows();

HSSFRow row ;
HSSFCell cell ;

for(int i=1;i<NO_OF_ROWS;i++){
row = sheet.getRow(i);
for(int j=0;j<=3;j++){
out.print("Name: "+ cell.getRichStringCellValue()+ " ");

out.print(cell.getNumericCellValue()+" ");

// Write the output to a file

if (fileOut != null)
if (fileIn != null)

Posts: 43011
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The POI jar file needs to be in the WEB-INF/lib directory of your web application.
prakash chauhan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks it worked.
Have you no shame? Have you no decency? Have you no tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!