Monday 20 April 2015

ADF: How to execute the ViewObject with a ViewCriteria on the PageLoad in ADF Web Application

This post explain how to restrict the ViewObject Query with a ViewCriteria on the page Load.

When the page is created with a Bounded Task Flow
  • Create a custom method in the Application Module.
  • Expose the method as a Client Interface.
  • Now there are 2 ways which you can invoke this method when the page loads.

  1. Drag the AM method from the Data Control into the BTF and add that as the Default Activity.
  2. Make a bean method as the Default Activity and then call the AM method from that. This is bit tricky. What you need to do is drag the AM method as a method to the BTF. This will created the needed bindings in the BTF. Then change the method property to map to the bean method. Then you can access the AM method from the Bean method. [Thanks to Timo Hahn from OTN Forum]


  • Sample code  to call the AM method from the Bean method.
  • Output

When the page is created without a Bounded Task Flow
  • Create a method in the managed Bean.
  • Call this method in PhaseListener. Need to be careful when you write code in the PhaseListener as this gets called in several times in the Page LifeCycle.

  • Output
Sample application built using Jdev 12.1.3 can be downloaded from here.

Reference : An Epic Question "How to call a method when the page loads"
Feel free to point out if anything is missing/wrong in this blog.

No comments:

Post a Comment