Hello everyone,
I've developed this java class
public class Counter
{
public static int counter;
public static int getCounter()
{
counter++;
return counter;
}
}
and the Jsp file is
<html>
<body>
The page is
<% out.println(Counter.getCounter());
%>
</body>
</html>
jsp file is stored in the ROOT folder and counter.java is stored in WEB-INF/classes folder
Now when i try to run the jsp file via http://localhost/Count.jsp it gives me the following error:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 4 in the jsp file: /Count.jsp
Counter cannot be resolved
1: <html>
2: <body>
3: The page is
4: <% out.println(Counter.getCounter());
5: %>
6:
7: </body>
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:319)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:565)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:309)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.31
Kindly help :)