File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes JSP beans using 'helper' classes? Plz help? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP beans using Watch "JSP beans using New topic

JSP beans using 'helper' classes? Plz help?

Kristy McClure

Joined: Jun 19, 2001
Posts: 13
I am very frustrated, trying to accomplish something I thought would be relatively easy.
I have a bean that is used to execute a sql statement and get a small resultset. I had code in this bean that would turn the resultset into a vector, for use by a JSP. I pulled out the 'vectorizing' code into a separate class, in the same package, so I could reuse it from other beans.
My problem seems to be that my original bean cannot get at the vectorizing class/bean, and I don't understand why, as what I'm doing corresponds with the various examples I have at hand.
Can someone help me figure out what I am missing, as the Java errors (or lack thereof) that I am getting do NOT tell me anything... -- gets specified column info from a specified table, for use in building a dropdown select box. See 'Vectorizer vizer = new Vectorizer();' and below in the setColVals() method: -- turns a resultset into a vector. I've tried using an empty constructor in this class, also no constructor, and a constructor witha debug statement in it, but apparently nothing gets even as far as running the class.

pardon me, but you've obviously mistaken me for someone who gives a damn...
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

If you are able to compile the SelectBuilder class,
my guess is that your createStatement is throwing
some exceptions, you catch them and return.
Unless your debug is true (i verified you
set it to false and you write to your log file.

The other possibility is your package stmt has a typo.
I know it is not in your posted code, but in real code.
Assuming that for posting your code in a public forum
you might have changed your package stmt, I for one
would do it...
Let us know what happens.
- satya

Take a Minute, Donate an Hour, Change a Life
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Just had to add $0.02...
Don't return from inside a catch block!
Don't return inside a try or finally either, use a flag to decide what to do then test the flag outside that code.
If you have the code as it stands then decide later on to add a finally, you'll end up getting code that executes after the return is called since the finally block is guarenteed to execute.
I can't paste it at the moment, but if you have a look at the various possibilities you can get some strange code, like exceptions that get thrown but just disappear...
I agree. Here's the link:
subject: JSP beans using 'helper' classes? Plz help?
It's not a secret anymore!