wood burning stoves
The moose likes JSP and the fly likes Not able to complie JSP file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Not able to complie JSP file." Watch "Not able to complie JSP file." New topic

Not able to complie JSP file.

prakash chauhan
Ranch Hand

Joined: Jun 22, 2007
Posts: 81
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" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.io.*,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)

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
The POI jar file needs to be in the WEB-INF/lib directory of your web application.
prakash chauhan
Ranch Hand

Joined: Jun 22, 2007
Posts: 81
Thanks it worked.
I agree. Here's the link: http://aspose.com/file-tools
subject: Not able to complie JSP file.
It's not a secret anymore!