-
1 Attachment(s)
[solved] class not found
i've installed tomcat 4.1.3 and jdk1.4.0 and here's the code i copied from the net. lol
PHP Code:
public class SimpleBean{
String message="No message specified";
public String getMessage(){
return message;
}
public void setMessage(String message){
this.message=message;
}
}
i compiled it as javac SimpleBean.java in the directory tomcat_installed\webapps\pubs\example. so the class SimpleBean.class is in the directory. i also copied the .jsp in the same directory.
Code:
<html>
<head>
<title>Reusing JavaBeans in JSP</title>
<style>
body,table{
font:9pt arial;
}
</style>
</head>
<body>
<center>
<table border=1 cellpadding=5>
<tr><th>Reusing JavaBeans in JSP
</table>
<p>
<jsp:useBean id="test" class="SimpleBean"/>
<jsp:setProperty name="test"
property="message"
value="Hello WWW"/>
<h2>Message:<i>
<jsp:getProperty name="test" property="message"/>
</i>
</h2>
</center>
</body>
</html>
but it says something about class not found exception. i set the classpath to tomcat_installed\common\lib\servlet.jar. is there something i'm still missing. my friend told me about jsp-api.jar in the said directory but i can't find it.
-
The class should go into
webappbase/WEB-INF/classes/
-
i know i can count on you. thanks corned. :)