Friday, November 5, 2010

Util code

public static MethodExpression getMethodExpression(
  String expr, Class returnType, Class[] argTypes){
  FacesContext fc = FacesContext.getCurrentInstance();
  ELContext elctx = fc.getELContext();
  ExpressionFactory elFactory = fc.getApplication().getExpressionFactory();
  return elFactory.createMethodExpression(
  elctx, expr, returnType, argTypes);
}
public static javax.faces.el.MethodBinding getMethodBinding(
  String expr, Class[] argTypes){
  FacesContext fc = FacesContext.getCurrentInstance();
  ELContext elctx = fc.getELContext();
  return fc.getApplication().createMethodBinding(expr, argTypes);
}

  SetPropertyListener listener = new SetPropertyListener(
    ActionEvent.class.getName());
  listener.setFrom(link.getRoute());
  listener.setValueExpression("to",
   JSFUtils.getValueExpression("#{pageFlowScope.route}", String.class));
  action.addActionListener(listener);
  AdfFacesContext.getCurrentInstance().getPageFlowScope()
    .put("route", link.getRoute());

No comments:

Post a Comment