aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Not able to complie JSP file." Watch "Not able to complie JSP file." New topic
Author

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?
-Thanks.

------------------------------------------------------------
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="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.*" %>

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

<%
FileInputStream fileIn = null;
FileOutputStream fileOut = null;

try
{
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++){
cell=row.getCell((short)j);
if(j==0){
out.print("Name: "+ cell.getRichStringCellValue()+ " ");
continue;
}

out.print(cell.getNumericCellValue()+" ");
}
out.println("\n");
}




// Write the output to a file

}
finally
{
if (fileOut != null)
fileOut.close();
if (fileIn != null)
fileIn.close();
}
%>


</body>
</html>
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42280
    
  64
The POI jar file needs to be in the WEB-INF/lib directory of your web application.


Ping & DNS - my free Android networking tools app
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.