Java Reference
In-Depth Information
Nothing appears to happen, even though the data was inserted into the table. We'll verify this by displaying all
the employees.
13.
In the browser, click the back button twice.
14. On the EmpApps page, click the Display All Employee option.
The browser will look like Figure 12-31 .
Figure 12-31.
Can you believe how easy it is to develop these functions using SDO and JSF? (Especially considering how long
it took to code the database access functions in Chapter 10.) Of course, many niceties are missing. For example, after
inserting the record, the entry fields should be blanked out and a successful insertion message should be displayed.
Also, none of the entered data was validated nor can we display the gross salary or tax amounts. These functions
can be coded in the pagecode class by the programmer. For now, however, we will finish the application by adding
functions to update and delete employee information.
Updating Data Using SDO and JSF
Update and delete functions are a little more complicated than display and insert. To modify or delete, the user must
first specify the employee to modify. The application must then retrieve and display that employee's information. This
“display Facelet” must have options to modify and delete which means two Facelets are needed: one Facelet to get the
employee number and one to display the specified employee information with the modify and delete options. We will
create GetEmp to retrieve the employee number and UpdateEmp will display the specified employee and have the
capability to update or delete. This means that two processes must occur:
1.
After the employee number is specified on GetEmp, UpdateEmp must be executed.
2.
GetEmp must make the employee number accessible to UpdateEmp.
To run UpdateEmp after the GetEmp submit button is clicked, we will create a JSF framework item called a navigation
rule. Navigation rules comprise the controller function of a JSF application. Navigation rules define what resources
should be accessed based on events and outcomes. Navigation rules eliminate the need to code redirects and
 
Search WWH ::




Custom Search