aspose file tools*
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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP beans using Watch "JSP beans using New topic
Author

JSP beans using 'helper' classes? Plz help?

Kristy McClure
Greenhorn

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...
SelectBuilder.java -- 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:


Vectorizer.java -- 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

Kristy:
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
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
David O'Meara
Rancher

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...
Dave.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP beans using 'helper' classes? Plz help?