Modify the FacultyProcess.jsp Page to Handle Faculty Data Collection and Insertion 2 – Develop Java Web Applications to Access Databases

At this point, we have finished all code development for this data manipulation or data insertion action to the Faculty Table in our sample Oracle database. Prior to building and running this Web application, make sure that the new faculty image to be selected and inserted into our database has been stored in a default folder in your local machine. All faculty images can be found in the folder Images\Faculty in the Students folder on the CRC Press ftp site. One can copy and paste them to the default folder in your computer.

Now we can build and run our project to test the new faculty record insertion function. Click on the Clean and Build Main Project button to perform cleaning up and building our project. Then click on the Run button to run our project. Enter the appropriate username and password, such as jhenry and test, to finish the login process, and select the Faculty Information item from the Selection.jsp page to open the Faculty.jsp page.

First enter a faculty member, such as Ying Bai, into the Faculty Name box and click on the Select button to query the record for this faculty member, then enter seven pieces of desired new faculty information into the associated seven fields as a new faculty record, and click on the Browse button on the File Selection box (above the Image TextField) to select a desired faculty image, White.jpg, which is located in our default project image folder and belongs to the new inserted faculty member, Susan Bai. The finished new faculty record is shown in Figure 8.84.

FIGURE 8.84   The entered new faculty information.

Click on the Insert button to try to insert this new faculty record into the Faculty Table in our sample database. Immediately you can see that all TextFields, including the Faculty Name, become blank or null, which means that this data insertion is successful.

To confirm this insertion, two methods could be used. The first is to use the Select button on the Faculty.jsp page to retrieve this new inserted record from the Faculty Table. To do that, enter Susan Bai in the Faculty Name field and then click on the Select but-ton. You can see that the new inserted record is retrieved and displayed in the seven fields with the new faculty image, as shown in Figure 8.85. Now click on the Back and Exit buttons to terminate our project.

The second way to confirm this data insertion is to open the Faculty Table by using either the Oracle SQL Developer or our connected database, CSE _ DEPT, under the Services window in the NetBeans IDE. Here we prefer to use the second way to confirm this insertion.

To use the second way to check the data insertion, first we need to connect to our database.

Perform the following operations to do this connection.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *