aspose file tools*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "compilation  error in JSP" Watch "compilation  error in JSP" New topic
Author

compilation error in JSP

Sridevi Kumarasamy
Greenhorn

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/>
<html>
<head><title>twain</title></head>
<body>
<form name=f1 method=post action=ebs.jsp>
<input type=submit value=scan>
<%=bill.initialise();%>
</form>
</body>
</html>

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.
org.apache.jasper.compiler.DefaultErrorHandler.jspError("DefaultError.java")
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java)
org.apache.jasper.compiler.Generator$generatevisitor.visit(Generatot.java)
and many more exceptions.

Can anyone help me in debugging the code.

With regards

Sridevi
Ben Souther
Sheriff

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
Greenhorn

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.

<%=bill.initialise();%>
semicolon is not necessary here

You should see to your application deployment first as Ben has suggested.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: compilation error in JSP