Home » ADF » ADF Tricks
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 Pandey is a Senior Developer with more than 3 years of experience in JAVA Programming. Currently enhancing skills in ADF.

Leave a Reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>