You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Shawn <ja...@koyuru.com> on 2001/08/01 00:49:51 UTC

Java Beans and JSP Question.

Dear Dan,

I believe I'm familiar with the problem you're having and think it's related to Forte.   In my case, either Tomcat or Forte complained about methods that were clearly there.  What I've had to do is take my bean and put it in two places.  Within Explorer in Forte which shows my filesystems I have c:\tomcat\webapps\myApp\WEB-INF\classes\com\koyuru.  I have also had to directly mount com\koyuru as a filesystem within Forte as well.  If I modify a bean in one, I must copy it to the other, otherwise either Tomcat or Forte will complain.

In my case I was using examples from the jspBook and tried to modify them but Forte claimed my new method wasn't there. It didn't seem so related to overloading as much as the filesystem.  That shut it up though.

Shawn


I have a standard java bean.  The different thing about it is that I
usually have two overloaded set methods per attribute.  For example,

public class MyBean {
    private int a;

    public setA (int a) throws Exception {
        if (a > 100) throw new Exception ("Must be less than 100");
    }

    public setA (String a) throws Exception {
        try {
            setA(Integer.parseInt(a));
        } catch (NumberFormat Exception exception) {
            throw new Exception ("Format incorrect.");
        }
    }

    //I usually have one getA
    public int getA() {
        return a;
    }
}

Now when I use this bean in a JSP that is stored in the request scope,
at times the compiler will complain that it cannot find a get method for
"A".  Even though one get method for that particular attribute is
clearly there.

Some added information, I use Forte Community Edition 2, and Tomcat.
Forte's compiler complains about one attribute while Tomcat complains
about another completely different attribute it cannot find the get
method for.  Which makes me itch with anger.  The note is my example
above is very simple. I used it just to explain my problem.  My actual
bean has about 17 attributes all with 2 setter methods each and 1 get
method each.

Does anyone know how to resolve this issue?

Thanks for your help.
Dan Hinojosa