Actually, the best thing to do would be to hit your favorite computer bookstore or the public library. Database-connected webapps are not something that can be well covered in a few short paragraphs. Industrial-grade webapps can be very complex.
The one thing I will say is that it's not considered good practice to access databases - or do any other sort of logic processing - directly on a JSP. While it's commonly done on ASPs and in other quick-and-dirty systems like PHP, the intermingling of the data (Model), the page display (View), and presentation interface logic (Controller) does not scale well if you want to produce something that's reliable and easy to maintain.
And since
Java and its frameworks tend to require a lot of up-front work, it's usually used for the heavy-duty stuff. Easier to do PHP or something like for lightweight one-off projects, just like Visual Basic vs. C++.
However, if you want to do so:
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jsps/jstlsql.html Even if you're not using Oracle, this should be a good start - the main difference is that other databases require different connection info.