ADF Tricks

ADF Tricks

Some solution are too small to write blog or article, today I will explain some common code which are required while creating application using ADF technology.

1. Get View Object Instance in Managed Bean.

BindingContext bindingctx=BindingContext.getCurrent();
BindingContainer binding=bindingctx.getCurrentBindingsEntry();
DCBindingContainer bindingsImpl = (DCBindingContainer) binding;
DCIteratorBinding dciter = bindingsImpl.findIteratorBinding(IteratorName);
ViewObject vo=dciter.getViewObject();

2. Redirect Page.


3. Gets Session Object value using Groovy language


4. Programmatically show Popup.
Bind popup component.

RichPopup.PopupHints ph1 = new RichPopup.PopupHints();;

5. Programmatically add Partial Target in Managed bean.


Where “mtab” is component binding which you want to refresh.

6. Create Session Object.

ExternalContext ectx=FacesContext.getCurrentInstance().getExternalContext();
HttpSession session=(HttpSession)ectx.getSession(false);

7. Add new row at the end of table.

CollectionModel tableModel = (CollectionModel)tablebinding.getValue();
JUCtrlHierBinding adfModel = (JUCtrlHierBinding)tableModel.getWrappedData();
DCIteratorBinding dciter = adfModel.getDCIteratorBinding();
NavigatableRowIterator nav=dciter.getNavigatableRowIterator();
Row newRow = nav.createRow();
Row lastRow = nav.last();
int lastRowIndex = nav.getRangeIndexOf(lastRow);
nav.insertRowAtRangeIndex(lastRowIndex+1, newRow);

“tablebinding” is a binding attribute of table from which you want to create new row.

8. Get Data base Connection Object in Model Layer.

PreparedStatement preparedStatement = this.getDBTransaction().createPreparedStatement("commit;",0);
Connection conn;
try {
conn = preparedStatement.getConnection();
} catch (SQLException e) {

About Manish Pandey

Manish is a Project Leader at Jagran Prakashan Ltd, focused on Jdeveloper Fusion Web Application(specifically Oracle ADF). He shares his knowledge through the OTN Jdev/ADF Forum. He has written more than 50 article about Oracle ADF and Jdeveloper.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.