8.6.2 Create the CourseProcess.jsp Page
The purpose of this page is to direct control to the different help class files based on the button clicked by the user on the Course.jsp page. The following Java Bean class files will be triggered and executed based on the button clicked by the user on the Course.jsp page:
FIGURE 8.99 The modified Course.jsp page.
1) If the user clicked the Select button, control will be directed to the course data query Java Bean class file CourseQuery.java to perform the course record query function.
2) If the user clicked the Insert button, control will be directed to the course data insertion Java Bean class file CourseInsertBean.java to do the course record insertion.
3) If the user clicked the Update or Delete button, control will be directed to the course record update and delete Java Bean class file CourseUpdateDeleteBean.java to perform the associated data manipulation.
4) If the user clicked the Back button, control will be returned to the Selection.jsp page to enable users to perform other information query operations.
Now let’s create the CourseProcess.jsp page.
Right-click on our JavaWebOracleCourse project in the Projects window and select the New > JSP item from the popup menu to open the New JSP File wizard. Enter CourseProcess in the File Name field and click on the Finish button.
Double-click on our new created CourseProcess.jsp page in the Projects window, under the Web Pages folder, to open this page. Enter the code shown in Figure 8.100 into this page. The new entered code is in bold.
Now let’s have a closer look at this code to see how it works.
A. You can embed any import directory using the JSP directive in a HTML or a JSP file. The format is <%@ page import=“java package” %>. In this page, we embed one pack-age, JavaWebOracleSelectPackage.*, since we will build our Java Bean class file CourseQuery.java under that package in the next section. We also embed a Java library, java.util.HashMap, since we need it to build our HashMap object list, c _ course.
B. Here a String array, C _ Field[], is generated, and its purpose is to map to six fields in the Course.jsp page. In fact, we can use this array to clean up all those fields when users forget to input a faculty name for the course data query.
C. A new instance of our Java Bean class, CourseQuery, that will be created in the next section, cQuery, is created since we need to use properties and methods defined in that class to perform course data query functions.

FIGURE 8.100 The code for the CourseProcess.jsp page.
D. The getParameter() method defined in the session class is executed to identify which submit button has been clicked by the user in the Course.jsp page. As you know, in all, we have five buttons on the Course.jsp page. All form data, including all text fields, list boxes and submit buttons, will be submitted to the CourseProcess.jsp page when any of five buttons is clicked. If a button is clicked, the getParameter() method with the name of that clicked button as the argument will return a non-null value. In this way, we can identify which button has been clicked. We use a sequence of if-else if selection structures to check all five buttons to identify the clicked button.
E. If the Select button is clicked by the user, the getParameter() method with the button’s name as argument will return a non-null value. This means that the user wants to perform a course record query from the Course Table in our sample database. Again, the getPa-rameter() method with the name of the faculty name field, FacultyNameField, is used to pick up a desired faculty name that is entered by the user from the Course.jsp page. The picked-up faculty name is assigned to a local String variable, fname.