troubleshooting Question

Simple JSP & Tomcat problem

Avatar of Xavior2K3
Xavior2K3 asked on
JSP
4 Comments2 Solutions575 ViewsLast Modified:
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-INF/classes/ch06_01.class

The CLASSPATH environment variable has been set to: C:\tomcat\common\lib\servlet-api.jar

And when i try and run the JSP i get an error:

---org.apache.jasper.JasperException: 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
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros