How to execute a method before the jsf page gets loaded
If you want to execute a method just before entering a page(jsff or jspx) in a task flow, just follow the below steps.
Go to page definition of the jsf page. In the bindings section, add the methodAction to the method which you want to execute.
In the executables section, add ‘invokeAction’ and then, in the dialog specify some id and select the method action which you added in bindings for the ‘Binds’ property.
Now, select the added action and click ‘Edit’ icon and specify the ‘Refresh’ property as ‘ifNeeded’ ( By default the value for ‘Refresh’ will be ‘deferred’).
Thats it. When you run the page, the method will be executed just before the actual page loads. So, if you want to execute some method(s) before loading a page, you can follow these steps.