http://www.oracle.com/technology/oramag/oracle/07-jul/o47frame.html
However at times you may won't to use the same ID being passed as a page parameter and setup various view objects using that ID prior to rendering the page. In that scenario I normally use a custom app module method which requires just the one action to be invoked, which then sets the view object parameters for multiple view objects for me. In the end my page binding only has to invoke my custom app module method and everything is done there for as many view objects which need to be setup prior to rendering the page.
Custom App Module Method Example
public void prepareEmpForView (String _empId)
{
// set as many view object where clauses as needed
GetEmpRecordImpl empVO = getGetEmpRecord();
empVO.setWhereClauseParam(0, _empId);
empVO.executeQuery();
}
Page Bindings
Note: Ensure the custom app module is exposed as a client method in the app module wizard before completing the bindings for the page
1. Right click on the page (JSP or JSPX) and select "Go To Page Definition"
2. Select View -> Structure
3. Right click on the bindings node and select "Insert Inside Bindings -> Method Action"
4. Select the app module data control
5. Select the method you wish to invoke in our example "prepareEmpForView"
6. Enter in the path to parameter values in my case it's usually the HTTP request parameter.
eg: #{param.id}
7. Press OK
Now all we need to do is invoke this method before the page is rendered.
8. Right click on the executables node and select "Insert inside Executables -> Invoke Action"
9. Set the id to what you like and ensure that the binds drop down is set to the "Method Action" in this case prepareEmpForView
Thats all you need now when the page is invoked it's vital that a page parameter ?id=xxxx is passed to the page as the method action requires that to invoke the custom app module method prior to rendering the page.
In this example not much point doing it this way if you only have to setup one view object , but if you have more view objects to setup and other code to invoke then I would do it as I have shown here.
1 comment:
Thanks Pas!
Your post helped me a lot !!
This works wonderful...
Post a Comment