8.1.4.2 Build the Transaction JSP File, FacultyQuery.jsp
The purpose of this file is to transfer data and information between our main display page,FacultyPage.jsp, and our working help class file, FacultyBean, which performs all JDBC- and database-related operations and business logic. The code for this file is shown
in Figure 8.14.
Let’s take a closer look at this piece of 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” %>. On this page, we embed two packages: java.util., since we need to use the List class, and JavaWebHibDBOraclePackage., since we build our FacultyBean help class in that package.
B. The getParameter() method is executed to get the faculty name entered by the user to the Faculty Name text field on the FacultyPage.jsp page, and this faculty name is assigned to a local String variable, fname.
C. A new instance of our help class, FacultyBean, is created.
D. The main help method, QueryFaculty(), we built in the FacultyBean is called to query a faculty record based on the faculty name we obtained from step B.
E. The setAttribute() method in the session class is executed to store each column of the queried faculty row from the Faculty Table with a given name. The getter() meth-ods defined in the FacultyBean class are executed to pick up each queried column. The point to be noted is that later on when we need to pick up these queried columns from the session object in other pages, we need to use names identical to those we used here for each column, such as facultyId, facultyName, title and so on.
F. Finally, since we need to display all queried columns in the associated text fields on the FacultyPage.jsp page, we use the sendRedirect() method to return to that page.
Finally let’s take care of the help class file, FacultyBean.

FIGURE 8.14 The code for the model and controller page, FacultyQuery.jsp.