Cudabean
Dec 11th, 2001, 05:36 PM
What I'm trying to do: I want to define an object in my jsp script and, perhaps later, run some methods on it. For now I'm keeping it as simple as possible. When I compile the following class, incorporate it into the package and call it from the jsp, I get the errors shown below.
Here's my super short JSP script:
<%@ page import="my.package.*" %>
<%! Wheedle a = new Wheedle(request, session); %>
Here's my Java Class that I'm calling from my script (The ['s aren't really there):
[ package my.package;
[ import javax.servlet.http.*;
[ class Wheedle {
[ public Wheedle(HttpServletRequest r, HttpSession s) {
[ System.out.println("Hi Earth");
[ }
[ }
Here are the JSP error messages that I receive on the browser:
[org.apache.jasper.JasperException: JASPER: Unable to compile class for JSPC:\WINNT\TEMP\JettyContext21934.tmp\_0002fexport_0002fwhy_0002ejspwhy_jsp_0.java:21: Can't access class my.package.Wheedle. Class or interface must be public, in same package, or an accessible member class.
[ Wheedle a = new Wheedle(request, session);
[ ^
[C:\WINNT\TEMP\JettyContext21934.tmp\_0002fexport_0002fwhy_0002ejspwhy_jsp_0.java:21: Can't access class my.package.Wheedle. Class or interface must be public, in same package, or an accessible member class.
[ Wheedle a = new Wheedle(request, session);
[ ^
[C:\WINNT\TEMP\JettyContext21934.tmp\_0002fexport_0002fwhy_0002ejspwhy_jsp_0.java:21: Undefined variable: request
[ Wheedle a = new Wheedle(request, session);
[ ^
[C:\WINNT\TEMP\JettyContext21934.tmp\_0002fexport_0002fwhy_0002ejspwhy_jsp_0.java:21: Undefined variable: session
[ Wheedle a = new Wheedle(request, session);
[ ^
[4 errors
Any ideas why this isn't working?
Here's my super short JSP script:
<%@ page import="my.package.*" %>
<%! Wheedle a = new Wheedle(request, session); %>
Here's my Java Class that I'm calling from my script (The ['s aren't really there):
[ package my.package;
[ import javax.servlet.http.*;
[ class Wheedle {
[ public Wheedle(HttpServletRequest r, HttpSession s) {
[ System.out.println("Hi Earth");
[ }
[ }
Here are the JSP error messages that I receive on the browser:
[org.apache.jasper.JasperException: JASPER: Unable to compile class for JSPC:\WINNT\TEMP\JettyContext21934.tmp\_0002fexport_0002fwhy_0002ejspwhy_jsp_0.java:21: Can't access class my.package.Wheedle. Class or interface must be public, in same package, or an accessible member class.
[ Wheedle a = new Wheedle(request, session);
[ ^
[C:\WINNT\TEMP\JettyContext21934.tmp\_0002fexport_0002fwhy_0002ejspwhy_jsp_0.java:21: Can't access class my.package.Wheedle. Class or interface must be public, in same package, or an accessible member class.
[ Wheedle a = new Wheedle(request, session);
[ ^
[C:\WINNT\TEMP\JettyContext21934.tmp\_0002fexport_0002fwhy_0002ejspwhy_jsp_0.java:21: Undefined variable: request
[ Wheedle a = new Wheedle(request, session);
[ ^
[C:\WINNT\TEMP\JettyContext21934.tmp\_0002fexport_0002fwhy_0002ejspwhy_jsp_0.java:21: Undefined variable: session
[ Wheedle a = new Wheedle(request, session);
[ ^
[4 errors
Any ideas why this isn't working?