File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes compilation  error in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "compilation  error in JSP" Watch "compilation  error in JSP" New topic

compilation error in JSP

Sridevi Kumarasamy

Joined: May 24, 2005
Posts: 3
I have a Java application, which I am using it as Bean in JSP page. I have jarred the necessary class files and kept it in tomcat5.0\common\classes directory.

my JSP Code is as follows:ebs.jsp

<@page language=java import=vendor>
<jsp:useBean id=bill scope=page class=Demo/>
<form name=f1 method=post action=ebs.jsp>
<input type=submit value=scan>

In this code, Demo is Java program, Vendor is my jar file and initialise() is a method in Demo program, which returns null value.

When I run this program in Tomcat5.0, I am getting the following errors:
Type:Exception report
The web server has encountered an internal error in fulfilling this request.
org.apache.jasper.JasperException:/evendor/ebs.jsp(2,0)The value for useBean class attribute Demo is Invalid.
and many more exceptions.

Can anyone help me in debugging the code.

With regards

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Sridevi Kumarasamy:
I have jarred the necessary class files and kept it in tomcat5.0\common\classes directory.

Jar files go in the lib, not the classes directory.

CATALINA_HOME/common is a place holder for classes and libraries used by both the applications and Tomcat itself. If your classes aren't being used by the Tomcat engine but need to be accessible by multiple applications, they should go under CATALINA_HOME/shared/classes or CATALINA_HOME/shared/lib (if they are jar files).

I prefer to put them under WEB-INF/classes or WEB-INF/lib. This keeps all of my code within the confines of my webapp.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Indraneel A Das

Joined: May 16, 2005
Posts: 9
Sridevi, there are some mistakes in your code also which I would like to point out :

your code :
<@page language=java import=vendor>

the page directive should be like this :

1) you missed '%' in directive
2) values for attributes like language, import should be put in quotes.
This applies to all places where attribute-value pairs are present.
3) You said vendor is jar file. Jar file name are never used in import statements. Only classes and packages are used in import statements. It should be ensured that jar files is present in application classpath.

semicolon is not necessary here

You should see to your application deployment first as Ben has suggested.
I agree. Here's the link:
subject: compilation error in JSP
jQuery in Action, 3rd edition