hai friends ,
i am using
tomcat 5.0.28 . i have written simple
jsp page as follows ,
<html>
<head>
<title> :: Sample page </title>
<body>
<%= Sample.getData() %>
</body>
</head>
</html>
here Sample is the class without any package structure as follows ,
public class Sample {
public static
String getData() {
return "From Sampl.class" ;
}
}
i have put this class file immediately under the classes directory of WEB-INF .
When try to access sample.jsp the following error is occur...
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /sample.jsp
Generated
servlet error:
/home/bala/jakarta-tomcat-5.0.28/work/Catalina/localhost/IMS/org/apache/jsp/sample_jsp.java:42: cannot resolve symbol
symbol : variable Sample
location: class org.apache.jsp.sample_jsp
out.print( Sample.getData() );
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
But if i create this Sample class under some package structure
(ie., like pack.Sample ) it is working fine ..
wht is the wrong in this ...?
thanks in advance.