This week's giveaway is in the Java/Jakarta EE forum. We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line! See Java code in JSP files. It's just receipt for trouble.
Lookup the DAO pattern and make use of it. In fact it is easy: create a DAO class which does all the JDBC task and takes or returns model objects (which are essentially javabeans). It must be able to run standalone as a Java application. Then create a servlet which controls the desired JSP page. Let the servlet use the DAO class to create/read/update/delete data using model objects. In the JSP page you can use JSTL/EL to access the data of the model objects.