Java Reference
In-Depth Information
For the time being, we will leave this very dull action as is.
6.
Switch back to the Properties view for the Submit button and start defining a navigation
rule by clicking the Add Rule . . . button.
The Add Navigation Rule window will be displayed. The only rule property that must be defined is the go to the
page; however, we can also define the rule as a default. In other words, we can associate this rule with all components,
pages, and/or outcomes. If there were several buttons on the page, the rule could be applied to all of them.
7.
From the Page drop-down button, select /c12/UpdateEmp.xhtml.
We will not change any of the other options on this page. This means that any outcome of any component action
on this page will result in the UpdateEmp Facelet being invoked. For instance, if there were multiple buttons, any
action against these buttons would invoke this navigation rule.
8.
Click the OK button.
The Properties View will be redisplayed and the rule will be shown in the navigation rules table. If you'd like
to see the XML that was generated, double click the faces-config file in WEB-INF. Then in the FacesConfiguration
Overview, click the Source tab and scroll to the end.
It is time to test the rule to see if it works and that the employee number is being set by GetEmp and being
retrieved by UpdateEmp.
9.
Run GetEmp.xhtml on the server.
GetEmp should be displayed in the browser.
10.
Specify 8989 as the employee number and click the Submit button.
The browser should display the UpdateEmp page with the employee number 8989 (see Figure 12-37 ).
Excellent!
Figure 12-37.
Tutorial: Updating and Deleting Using a Relational Record
All we need to do now is change UpdateEmp so that it actually updates and deletes.
1.
Close any open editing or browser sessions and open an editing session for UpdateEmp.jsp.
2.
In Design view, click on a Relation Record item in the Data and Services drawer and then
click beneath the existing text.
The Add Relation Record window will be displayed. As with AllEmps and InsertEmp, this window allows us to
specify controls. Unlike earlier when we created display or create controls, UpdateEmp needs controls to both update
and delete.
 
Search WWH ::




Custom Search