A. Some local variables, such as an instance of ResultSet, rs; a blank string, fid; and an inte-ger variable, numUpdate, are declared since we need to use them to hold our query results.
B. A try-catch block is used to do our first query for the Faculty Table to get a desired faculty _ id based on the selected faculty _ name. First a valid database connec-tion is established by calling our user-defined method, DBConnection().
C. A PreparedStatement object, pstfid, is generated with a connection object, con, and query statement to get the desired faculty _ id based on the selected faculty _ name, and the latter is a positional dynamic input parameter.
D. A system method, setString(), is executed to set up the input positional dynamic param-eter that is stored in the input ArrayList instance, cdata; that is, it is located at the first position on that list, so another system method, get(0).toString(), is used to pick it up.
E. The first query is executed by calling the system method executeQuery(), and the returned query result is stored in the instance of ResultSet class, rs.
F. A while() loop with its condition, rs.next(), is executed to pick up the selected fac-ulty _ id by calling a system method, getString(). The argument of that method is the column name of the faculty _ id.
G. The second query statement is created with a standard Update query statement format with seven input positional dynamic parameters. One point to be noted is that the order of those input positional parameters must be defined with the input faculty _ name as the first one, followed by six pieces of updated course information.
H. Another PreparedStatement object, pstmt, is declared with the second query statement.
I. A sequence of setString() methods is executed to set up and initialize all seven input positional parameters, which include an updated course record and the selected faculty _ name.
J. The second query is executed by calling a system method, executeUpdate(), and the run result is returned and assigned to the integer variable numUpdate.
K. A sequence of cleaning jobs is performed to close all objects we used for these queries. L. If this course updating is successful, a non-zero integer value would be returned, and a true is also returned to the consuming project to indicate that situation.
M. Otherwise, if a zero is returned, which means that the data update fails and no record has been updated in our database, a false is returned to indicate this error.
N. The catch block is used to monitor and track those query operations. A false would be returned if any exception occurred.
Now one can click on the Clean and Build Project button to build our Web Service project to compile and update this new operation. Finally let’s build our Web opera-tion, DeleteCourse().