8.6 QUERY THE COURSE TABLE USING JAVASERVER PAGES AND JSP IMPLICIT SESSION OBJECT
In this section, we discuss how to perform a data query from the Course Table in our sample Oracle database, CSE _ DEPT, via the Course.jsp page we built in Section 8.4.1.4.
Basically the function of this page is to enable users to retrieve all courses, that is, all course _ id values, taught by the selected faculty member and display them in the CourseList box. Also, the course details related to a selected course _ id from that CourseList box will be retrieved and displayed in six TextFields in that page.
To save time and space, we can copy and modify the project JavaWebOracleSelect to make it our new Web application project, JavaWebOracleCourse. Perform the following steps to cre-ate this new project:
1) In the Projects window, right-click on the project JavaWebOracleSelect and select the Copy item from the popup menu to open the Copy Project wizard, as shown in Figure 8.97.
2) Enter our new project name, JavaWebOracleCourse, into the Project Name box; browse to the default project folder, C:\Class DB Projects\Chapter 8, as the Project Location, which is shown in Figure 8.97; and click on the Copy button.
A new project, JavaWebOracleCourse, is generated and added into our Projects window. Next let’s add some JSP pages and build the code for the related pages to perform the data query from the Course Table in our sample database.

FIGURE 8.97 The opened Copy Project wizard.
8.6.1 Modify the Course.jsp Page
The Course.jsp page works as a client or a view to provide the display function for all user input and query results. We need to modify this page to enable it to forward the user’s inputs to the controller page, CourseProcess.jsp, and furthermore to call the Java Model or Java Bean CourseQuery.java to process our data query. Also this client page needs to return to the Selection.jsp page if the user clicks on the Back button.
First let’s do some modifications on this page to add two functions:
1) Add a Details button under the CourseList box, since we need this button to trigger an event on the CourseProcess.jsp page and Java Bean to retrieve the course details related to a course _ id if it is selected from the CourseList box by the user.
2) Add a piece of JSTL code to collect all course _ id values retrieved from the database and display them in the CourseList box.