First page Back Continue Last page Graphics

Using pageFlowScope Without Writing Java Code


Notes:

Using pageFlowScope Without Writing Java Code

The af:setActionListener tag provides a declarative way to cause an action source (for example, af:commandButton) to set a value before navigation. You can use pageFlowScope with af:setActionListener to pass values from one page to another, without writing any Java code in a backing bean.

Suppose you have a master page with a single-selection table showing employees, as shown in the first example in the slide:

1. The EL variable name emp is used to represent one row (employee) in the table.

2. The action attribute value of af:commandButton is a static string outcome showEmpDetail.

3. The af:setActionListener tag, which has two attributes from and to, takes the from value and stores it with the to value.

When the user clicks the command button on a row, the action listener executes, and the value of #{emp} is retrieved. The retrieved row object is stored as the empDetail property of pageFlowScope with the #{pageFlowScope.empDetail} EL expression—you don’t need to write any Java code in a backing bean. Then the action event executes with the static outcome, and the user is navigated to a detail page:

4. On the detail page, you refer to the pageFlowScope.empDetail objects to display more data for the current employee, as shown in the second example in the slide.