Tuesday, August 13, 2019

Reset Code for Reset View Object

This code you have to write in the bean created


public Object resolvElDC(String data) {
        FacesContext fc = FacesContext.getCurrentInstance();
        Application app = fc.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = fc.getELContext();
        ValueExpression valueExp =
            elFactory.createValueExpression(elContext, "#{data." + data + ".dataProvider}", Object.class);
        return valueExp.getValue(elContext);
    }

    public void resetButton(ActionEvent actionEvent) {
        searchAMImpl am = (searchAMImpl)resolvElDC("ApplicationDataControl");
        ViewObject empVo = am.getEmployees1();
        ViewObject attrVo=am.getattr1();
        empVo.setNamedWhereClauseParam("EmpIdBind", null);
        empVo.setNamedWhereClauseParam("FirstNmBind", null);
        empVo.setNamedWhereClauseParam("EmailBind", null);
        empVo.setNamedWhereClauseParam("SalaryBind", null);
        empVo.executeQuery();
        attrVo.executeQuery();
   
    }

No comments:

Post a Comment