tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefán F. Stefánsson <stef...@snote.decode.is>
Subject RE: BY ANY BEANS NECESSARY!
Date Wed, 28 Mar 2001 20:42:37 GMT
you need to compile your beans into "d:\webpage\jsp\WEB-INF\classes".
You shold look at documentation about webapps in the Servlet
specification and Tomcat documentation.

-----Original Message-----
From: Arif Tayebali [mailto:atayebali@acom.com]
Sent: 28. mars 2001 20:26
To: 'tomcat-user@jakarta.apache.org'
Subject: BY ANY BEANS NECESSARY!
Importance: High


Does anyone know where to place JavaBeans in Tomcat??
And how do I reference these Beans from JSP pages??
And are these beans are to be saved as .class files??

Tomcat is located at D:\Tomcat
Webapps is located at D:\webpage\jsp

I have compiled my Beans and placed them in the 

	D:\Tomcat\webapps\examples\WEB-INF\classes dir

But receivee this error at runtime:
	
	Root cause: 
      java.lang.ClassNotFoundException: Unable to load class TimeBean

The bean looks like this:

public class TimeBean {

   private int hours;
   private int minutes;

   public TimeBean() {
      java.util.Date now = new java.util.Date();
      this.hours = now.getHours();
      this.minutes = now.getMinutes();
   }

   public int getHours() {
      return hours;
   }

   public int getMinutes() {
      return minutes;
   }

}

and the jsp file looks like this:

<jsp:useBean id="help" scope="session" class="TimeBean" />
<jsp:setProperty name="help" property="*" />

<html>
<body>
You entered the input, <b><jsp:getProperty name="help"
property="minutes"/></b><br>
</body>
</html>

Thanks in advance!


Mime
View raw message