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...
        try{
        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){
            e.printStackTrace();
        }
    }

Thanks

Popular posts from this blog

ADF : Get Current Logged User Name

OAF : Get Current Row in Table

ADF : Working with ViewCriteria