9.16.3 Modify the Java Bean CourseQuery.java and the Control File CourseProcess.jsp
Open the NetBeans IDE 12.0 in Administrator mode by right-clicking on the NetBeans IDE icon on the desktop and select Run as administrator item. Launching the NetBeans IDE 12.0 in this way is very important to enable us to build and run our client projects correctly. Otherwise you may encounter runtime errors when you run our client project. Double-click on our Java Bean class file CourseQuery.java from the Projects window to open this file, and perform the following modifications to the code inside two methods, getCourse() and QueryCourse():
1) Remove all original code from the constructor of this Java Bean class file, since we do not need any code to connect to our sample database; this connection job is handled by opera-tions in our Web Service project.
2) Remove the entire method CloseDBConnection() with all code for that method, since closing can be handled by operations in our Web Service.
3) Modify the first part of code inside the methods getCourse() and QueryCourse() as shown in Figure 9.100. The modified parts are indicated with bold.
Let’s have a close look at the modified code in Figure 9.100 to see how it works.
A. A Java package, java.util.*, that included the ArrayList and HashMap classes is imported into this file, since we need to use those components to store collected course details later.
B. Remove all original code from the constructor of this class and keep it empty, since we do not need to use it in this project.

FIGURE 9.100 The first part of the modified code for the Java bean CourseQuery.java.
C. The first course query method, getCourse(), is declared with a selected faculty name as the argument. This method is used to call one of our Web Service operations, QueryCourseID(), based on the selected faculty name to get all course _ id taught by that faculty member and display them in the Course ID ListBox in the Course.jsp page.
D. Some local variables, including an ArrayList instance, al; an integer variable, index; and a HashMap object, sCourse, are declared, and they are used to store the queried course _ id and work as a loop counter to build a HashMap object to save the queried course _ id.