File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP beans using 'helper' classes? Plz help?

 
Kristy McClure
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic