create MethodBinding MethodExpression ValueExpression

1. create MethodBinding MethodBinding methodBinding = FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{bean.method}", null);

2. create MethodExpression
        ExpressionFactory expFactory = FacesContext.getCurrentInstance().
            getApplication().getExpressionFactory();
        ELContext elContext = FacesContext.getCurrentInstance().getELContext();
        MethodExpression expression = expFactory.createMethodExpression(elContext, "actionName", String.class, new Class[]{});

        commandComponent.setActionExpression(expression);

3. create ValueExpression
   ValueExpression valueExpression = expFactory.createValueExpression(elContext, "#{bean.value}", String.class);

你可能感兴趣的:(bean)