nested sql queries using JSP - pls help

Hi! I have two tables and would like to display the combined content of the two tables. I appreciate if you could assist me. The two tables are: course ------ course_id course_name session ------- session_id session_time course_id (FK)

This is the output I would like to achieve. when click on the + , the related session belongs to a course will show. + course 1 - session 1 - session 2 + course 2 - session 4 In the following code, I sort of pull everything out and thinking of using javascript to hide it (I have not done this one yet). When user click on it, it opens. I am not sure if its even possible to retrieve the data only when user click on the + and not preloaded. This is a snapshot of my code: The error message is: "Operation not allowed after ResultSet closed" ------------------------------------- <jsp:useBean class="com.db.ConnectionManager" id="CM" scope="session" /> <%@ page import ="java.util.*"%> <%@ page import="java.sql.*" %>