Using other ADF PageDefs in JSF EL Expressions

At the JHeadstart Discussion Forum, we got a question from Lavanya how to make sure that a reference to another ADF Page Definition works, even if you are not navigating from the page to which it belongs.

Lavanya wants to use a reference to an ADF binding of the UserProfiles page, referenced using the EL expression #{data.UserProfilesPageDef.UserProfilesCurrentCommunityId}, in another page than the UserProfiles page.

You can refer to another PageDef's bindings (as opposed to the bindings of the current page's PageDef), by referring to #{data.OtherPageDef.xyz} instead of #{bindings.xyz}, as you would do in the other page.

In order to use bindings of another PageDef, that PageDef must have been
loaded first. If you navigate from the UserProfiles page, that page has
loaded the UserProfilesPageDef. To force loading the
UserProfilesPageDef if you have not opened the UserProfiles page yet, JHeadstart offers you an easy method. You can set a parameter in PageDef of the page where you want to use the other page's bindings:

<parameters>
  <parameter id="bindingContainersToPrepare"
             value="#{'UserProfilesPageDef'}"/>

</parameters>


JHeadstart looks at the parameter bindingContainersToPrepare (a binding container is the runtime instance of a page definition) and ensures that they are loaded when you run the page. In the prepareModel phase of the JSF Page Lifecycle, JHeadstart calls the method JhsPageLifecycle.prepareBindingContainers to achieve this.

You
can add such a parameter by going to the target page's PageDef, and in
the structure window right-click the 'parameters' folder, and choose
'insert inside parameters' -> 'parameter'.
Inserting a parameter in a Page Definition:

Enter the id bindingContainersToPrepare, and as the value, enter an expression that returns the name of the other page definition as a String. If you want to load multiple PageDefs you can specify a comma-separated list.
Properties Dialog of a Page Definition Parameter:

Don't forget to
uncheck 'Clear Page Definition Before Generation' for this group, otherwise
your changes get lost when you run the JHeadstart generator. If you don't see this property, switch to Expert Mode first.
Expert Mode:

After that you can find the property under the category Generation Settings.
Clear Page Definition property:

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Java EE Consultants - JHeadstart, ADF, JSF

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today