Java Reference
In-Depth Information
If you got error messages in the console when you clicked the Update button, it could be because the value
entered is too big. If a database character field value is entered that is not the database field maximum size, many
DBMSs will pad the value with spaces. For example, the employee name field was defined as 25 in length. When edqr
was entered as the name, the DBMS may have put 21 spaces at the end of edqr. When the info for employee 8989 was
displayed, the name displayed was actually edqr. If you replaced edqr with Frank Tester, the actual value in the field
was 33 characters in length—the 12 characters that comprise the name plus the 21 blanks that the DBMS added.
You can prove this by clicking in the far right of any text field that contains character data that isn't the maximum
field size. The cursor is placed after the spaces, well after the last visible character. So to get around the error, simply
select the characters and the spaces in the text field then type the new information.
6.
Click the browser's back button until the Employee Applications page is redisplayed.
7.
Click on the Display All Employees link.
(If Frank Tester's info doesn't appear, refresh the page.) The browser should look like Figure 12-43 .
Figure 12-43.
8.
Click the browser's back button until the Employee Applications page is redisplayed.
9.
Choose Update An Employee and specify Frank Tester's employee number 8989.
10.
On UpdateEmp, click the Delete button.
The input fields will be cleared.
11.
Click the browser's back button until the Employee Applications page is redisplayed.
12.
Click on the Display All Employees link.
Only three employees should appear and Frank Tester should no longer be displayed. (If Frank Tester appears,
refresh the page.)
13. Choose Update An Employee, specify 8989, and click Submit.
Notice that the update page is displayed with no data (rightfully so because we deleted Frank Tester). However,
the console is full of error messages with the originating message saying, “an index is out of bounds.” Because there is
no employee 8989, when the RR attempts to read the data from the DBMS there is an error. When there is no employee
to update, the update page really shouldn't be displayed but unfortunately, this is not how the RR functions.
Search WWH ::




Custom Search