Hi,

Try putting your class in a package. I'm not sure whether servlet containers
like Tomcat are required to honour the "default" package.

You're on the right track though.

--Jeff

On Tue, Mar 27, 2001 at 06:39:27PM -0800, Arif Tayebali wrote:
> 
> 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!

Reply via email to