[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
[Home]
Re: Bean not working
Carsten Heyl wrote:
> >There are no errors in any of the logs. I've included my attempt
> >at a "bean" below. I know I'm not using get/set methods, but
>
> Looks o.k.
>
> >was just trying to get ANY method to work. The TestBean.class
> >file is included in a wrapper.classpath= statement in my config
> >file, although it's not in a jar.
>
> You know that you have to restart your web server if
> you change the bean when putting it in wrapper.classpath?
> If you want autoreload put it in repositories in your
> zone.properties.
>
> Human language is not very precise,
> from your words it can mean you wrote
>
> wrapper.classpath=/my/path/TestBean.class
>
> that would be wrong, you have to add the directory /my/path.
Yes, I've tried wrapper.classpath=/my/path/beandir, and also
repositories=/home/www/wrox/test.jar, to no avail. Still not sure
what the problem is. Any suggestions would be appreciated.
-Bernie
> >
> >//TestBean.java
> >import java.util.*;
> >import java.io.*;
> >
> >public class TestBean {
> >
> >
> > public TestBean() {
> >
> >
> > }
> >
> >
> > public int SetVar(int NumVar)
> > {
> > return(NumVar + 5);
> > }
> >
> >
> >}
> >
> >
> >
> >>
> >> >I have a bean which has a public class named SetVar().
> >> >When I call SetVar() from the .jsp page below, a blank
> >> >page is displayed in the browser. If I rem out the line
> >> >x = beanAlias.SetVar(i), I then see "Hello World" and
> >> >"The value of x is 0". Why is the page blank when I
> >> >make the call to the bean?
> >> >
> >> >
> >> ><html>
> >> ><head>
> >> ><title>TestBean.jsp</title>
> >> ></head>
> >> ><body>
> >> >
> >> ><%@ page language="java" %>
> >> >
> >> ><jsp:useBean id="beanAlias" scope="application" class="TestBean" />
> >> >
> >> ><%
> >> >int i = 8;
> >> >int x = 0;
> >> >//x = beanAlias.SetVar(i);
> >> >%>
> >> >
> >> ><H1>The value of x is <%= x %></H1>
> >> >
> >> ><%
> >> >out.println("Hello World");
> >> >%>
> >> >
> >> ></body>
> >> ></html>
> >> >
> >> >
> >> >
> >
> >
>
>