Xavior2K3
asked on
Simple JSP & Tomcat problem
Hi,
I'm currently learning JSP and i have an example in my book that i cant get working. I'm really stuck as to why. I'm using the latest Tomcat (5.5.17) and i havent changed any config files at all.
ch06_01.java
---------------
public class ch06_01 {
public ch06_01() {}
public String msg() { return "Hello from JSP!" };
}
ch06_02.jsp
--------------
<%@ page import="ch06_01" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Using a JavaBean</title>
</head>
<body>
<%
ch06_01 messenger = new ch06_01();
out.println(messenger.msg( ));
%>
</body>
</html>
The java file compiles fine and i put it into the correct folder: tomcat/webapps/ch06/WEB-IN F/classes/ ch06_01.cl ass
The CLASSPATH environment variable has been set to: C:\tomcat\common\lib\servl et-api.jar
And when i try and run the JSP i get an error:
---org.apache.jasper.Jaspe rException : Unable to compile class for JSP
---Generated servlet error:
---The import ch06_01 cannot be resolved
---An error occurred at line: 9 in the jsp file: /ch06_02.jsp
---Generated servlet error:
---ch06_01 cannot be resolved to a type
---An error occurred at line: 9 in the jsp file: /ch06_02.jsp
---Generated servlet error:
---ch06_01 cannot be resolved to a type
I would be very grateful if someone could point out why this isnt working.
Kind Regards,
Michael
I'm currently learning JSP and i have an example in my book that i cant get working. I'm really stuck as to why. I'm using the latest Tomcat (5.5.17) and i havent changed any config files at all.
ch06_01.java
---------------
public class ch06_01 {
public ch06_01() {}
public String msg() { return "Hello from JSP!" };
}
ch06_02.jsp
--------------
<%@ page import="ch06_01" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Using a JavaBean</title>
</head>
<body>
<%
ch06_01 messenger = new ch06_01();
out.println(messenger.msg(
%>
</body>
</html>
The java file compiles fine and i put it into the correct folder: tomcat/webapps/ch06/WEB-IN
The CLASSPATH environment variable has been set to: C:\tomcat\common\lib\servl
And when i try and run the JSP i get an error:
---org.apache.jasper.Jaspe
---Generated servlet error:
---The import ch06_01 cannot be resolved
---An error occurred at line: 9 in the jsp file: /ch06_02.jsp
---Generated servlet error:
---ch06_01 cannot be resolved to a type
---An error occurred at line: 9 in the jsp file: /ch06_02.jsp
---Generated servlet error:
---ch06_01 cannot be resolved to a type
I would be very grateful if someone could point out why this isnt working.
Kind Regards,
Michael
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Oh i see, i thought it might be that!! Great, thanks both for your help!
ASKER