ADF : Send Parameter to actionListener method inside Bean

actionListener method method can be invoked by Adf Button , Link and Image.
actionListeners methods have only one parameter of type javax.faces.event.ActionEvent.

if requirement is to send some parameter to that bean method who’s signature is something like
public void myActionListener(ActionEvent actionEvent)

The solution to achieve this requirement is putting an attribute tag from the JSF.Core inside the commandButton (or whatever actionable component you are using). So the code in the jsp page looks like this:

Now i can get the value in the bean method by using below code

public void myActionListener(ActionEvent actionEvent) {
  // Add event code here...
  String paramValue = (String)actionEvent.getComponent().getAttributes().get("paramName");
  System.out.println("paramValue = " + paramValue);

OAF : Number Format

In OAF, There is not format expression in BC4J like ADF, So you do formatting using controller classes.

There are 2 ways to format numbers in OAF

1- Format Numbers
Write this code  in processRequest method

import oracle.cabo.ui.validate.Formatter;

        Formatter formatter =
            new OADecimalValidater("###,###,##0.00", "###,###,##0.00");
        OAWebBean numericBean = webBean.findChildRecursive("<>");
        if (numericBean != null)
            numericBean.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter);

2- Format Number using currency format

Write this code  in processRequest method
        OAWebBean currencyBean = webBean.findChildRecursive("<>");
        if (currencyBean != null)
            currencyBean .setAttributeValue(CURRENCY_CODE, "USD");


Display Calender in SQL and PLSQL

Today I will present how to display calendar specific month from oracle SQL or PLSQL like below image

So I will present the solution to do this

First I will create Object type to handle week days( Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday)

ADF ::: Creating View Criteria Programmatically

We can add view criteria programmatically at run-time to ViewObject. So that we not only depend on Design View Criteria.

The following is an example used to create View Criteria in Application Module Impl

ViewObject empVO= this.findViewObject("EmpVO"); ViewCriteria vc = empVO.createViewCriteria(); ViewCriteriaRow vcRow = vc.createViewCriteriaRow(); // ViewCriteriaRow attribute name is case-sensitive. // ViewCriteriaRow attribute value requires operator and value. // Note also single-quotes around string value. ViewCriteriaItem enameItem= vcRow.ensureCriteriaItem("Ename"); enameItem.setOperator("="); enameItem.getValues().get(0).setValue("Mahmoud Elsayed"); vc.add(vcRow); empVO.applyViewCriteria(vc);

ADF ::: Handle af:query search Button Programatically

The following code snippets is to execute search button in ADF Query search button programmatically without interact from User

    public void onQueryListener(QueryEvent queryEvent) {
        // Add event code here...
        FacesContext fcsCtx = FacesContext.getCurrentInstance();
        ELContext elCtx = fcsCtx.getELContext();
        ExpressionFactory expFactory = fcsCtx.getApplication().getExpressionFactory();
        MethodExpression mthdExp =
            expFactory.createMethodExpression(elCtx, "#{bindings.EmpVOCriteriaQuery.processQuery}", null,
                                              new Class[] { queryEvent.getClass() });
        mthdExp.invoke(elCtx, new Object[] { queryEvent });
        catch(Exception e){


OAF : NewRowState of New Rows

By default, entity objects are created with the row state of STATUS_NEW, and BC4J adds them to its validation.  In this case, any event that triggers a validation or database post sequence includes these entity objects. As per OAF Model Coding Standards, always circumvent this behavior by explicitly calling the setNewRowState(STATUS_INITIALIZED) method on its containing ViewRowImpl immediately after you insert the newly created row. This sets the state of any associated entity objects to STATUS_INITIALIZED. When you do this, BC4J removes the corresponding entity objects from the transaction and validation listener lists, so they will not be validated or posted to the database. As soon as the user makes a change (an attribute "setter" is called), the entity object's state changes to STATUS_NEW, and BC4J returns it to the validation/post lists. You can also call setNewRowState(STATUS_NEW) on the ViewRowImpl to change the state manually at any time.
Let's t…

OAF: Parameters

Oracle Application Framework (OAF) can pass parameters between pages and there are three types of parameters
1- Request
The scope of request parameters is finalized after  HTTP request.

Examples of Request Parameters
URL ParametersInput Bean values (Message Text Input, Choice , Check etc) and Hidden Field Values (form values) in case of postEvent triggering bean and the action in case of post.
Request values are accessed using OAPageContext.getParameter() method.

2- Transaction
Transaction has wider scope than Request which finalize with ending of database transaction.
You can create transaction parameter using OAPageContext.putTransactionValue() , ((OADBTransactionImpl)getTransaction()).putValue() .

Get transaction parameter values using OAPageContext.getTransactionValue() , ((OADBTransactionImpl)getTransaction()).getValue()

3- Session
Session has wider scope than Transaction which his life time is until user log out from application.

You can create Session parameter using OAPageContext…