The code snippet below shows how to query database using JSTL in JSP. The var attribute is important which contains the results returned.

Java Code:
<sql:query   var="hobbies" sql="SELECT * FROM HOBBIES">
</sql:query>