One of the cleanest and most useful practices in Oracle ADF is to use jsff page fragments.
They allow you to have one view composed of multiples small view fragments.
It’s more precise, easier to maintain and allow you to reuse the same fragment multiple times on the same page. (Having multiple time the same toolbar for example)
The most common error you’ll encounter once you added a fragment to your page is “Access Denied” displayed where your data should be.
This error occurs when your page fragment uses a different DataBinding file than your parent page.
As a best practice, I always recommend having your page fragments use the parent page definition file.
Here is how to fix this :
- Add your page fragment to your parent page as a declarative component
- Ensure both pages have a different Page definition file by drag&dropping an element from the data control to both pages and clicking on the “Bindings” tab. (They should have a different file in the “Page Definition File” attribute)
- Optional: if you have already some binding set on your fragment, copy the content of his page definition file to the parent page definition file. (we are going to use the parent one)
- Navigate to your DataBinding.cpx file (usually found at ViewController/adfmsrc/view/DataBinding.cpx)
- Change the “usageId” attribute of your page fragment to use the same as your parent page. (See example code below)
- Restart JDeveloper, and that’s it, your fragment page now use the parent page definition file as his binding file.
Note: you should do this for each fragment page you add