The preferred (best practice) way to do things with server side
java is to avoid doing any database, business, or web flow from within the JSP.
Instead, most JSP developers, these days, are responding to the request with a
servlet which makes calls to the business layer (written with plain old Java objects) which returns the results in beans or lists of beans, etcc.
Context is then forward to JSPs where JSTL and EL are used to iterate over the results and build the needed HTML for displaying the results.
If you want a very small simple example of this, I have a demo app on my site:
http://simple.souther.us Look for SimpleMVC.
This example doesn't read from a database but it (hopefully) makes it clear where the DB operations should take place.
Also, Bear Bibeault has written an article explaining how this works.
I'll look for and post a link if he doesn't first.