Sample application - ExecuteWithParams.zip, is based on DEPARTMENTS table from standard HR schema. Business logic of developed sample is based on idea to allow edit operation only for departments from specified geographic region. Edit form allows to change department location, but only within specified region. And finally, region is specified in property file called UIResources.properties.
In order to achieve business logic requirements I have changed default SQL for Departments View Object - I have joined Departments table with Locations and Countries, in order to retrieve departments only from region specified in :regionIdVal bind variable:
Departments edit form contains location component, I have implemented this component as af:selectOneChoice. It allows to select only locations within specified region. This means, ExecuteWithParams should be also applied for this component. I have edited default SQL for Locations View Object, this View Object is used as a List Data Source for af:selectOneChoice. Modified SQL statement:
Value for :regionIdVal is assigned in ExecuteWithParams action also. This value is defined in UIResources.properties file, for example: regionId=2, you can change it's value at any time.
Let's switch to ExecuteWithParams action. I have created required actions in such way - at first I have dragged and dropped needed data controls and after that I have created actions in page definition file manually. ExecuteWithParams action for Departments View Object definition:
You can notice, that action have one parameter - regionIdVal. When action is created, don't forget to add executable - invokeAction into page definition file for ExecuteWithParams. This will enable automatic execution of defined action. Executable for DepartmentExecuteWithParams action:
Action and executable for Locations View Object can be created in the same way.
And..., how it works:
Edit form shows departments only from region specified in property file, at the same time af:selectOneChoice allows to choose locations only from specified region also.
When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.