Chris wrote:

> I'm trying to create Beans based on my own Bean classes, and it's just
> not working. I'm using Win 98, and the JSP 1.0 stuff from Sun. I've
> based my work after Sun's NumberGuessBean example. I've created my own
> web app, and copied the NumberGuessBean files to my new web app
> directory under WEB-INF like a good boy. I can use the NumberGuessBean
> class no problem - however, I can't get at my own classes.
>
> One class is a very simple class called 'MathWhiz', with one method,
> sum(), that returns the sum of two numbers. I put this in the same
> directory as NumberGuessBean, I added an page import directive for it in
> my JSP code (just like NumberGuessBean), everything. And all I get is
> ClassDefNotFound errors.
>
> So I tried again, this time copying the NumberGuessBean class and making
> an identical class called NumberGuessBean2. Then I completely mirrored
> everything for NumberGuessBean. This gave me an error too (but I can't
> tell what it is cause there's not room in my DOS box to show it all).
>
> What am I doing wrong?
>

What directory your beans in is not the key issue ... what you must do is add
the directory they are in to your CLASSPATH.  The "startserver" script (or
"startserver.bat" on Windows) constructs a class path that the servlet engine
runs under, and any class you want to use in a servlet or JSP needs to be
visible somewhere on that path.

If you look at the "startserver" script, you see it will add a directory
{JSWDK_HOME}/classes to the class path if that directory exists, and this
seems like a real convenient place to put beans and things that might be used
in more than one web-app.  For my system, that means I put these beans in:

    /usr/local/jswdk-1.0-ea/classes

If you put them anywhere that is not listed in the class path that this script
constructs, you will need to modify the startserver script to include your
directory as well.

Craig McClanahan

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to