JSF1.2中 ValueExpression的用法

添加评论 46 views 2010年6月6日

JSF1.2中 ValueExpression的用法

/**
* Method for taking a reference to a JSF binding expression and returning
* the matching object (or creating it).
* @param expression EL expression
* @return Managed object
*/
public static Object read(String expression) {
FacesContext context = FacesContext.getCurrentInstance();
ELContext elContext = context.getELContext();
ValueExpression ve = context.getApplication().getExpressionFactory()
.createValueExpression(elContext ,
column.getProperty(), Object.class);
if(ve == null) return null;
return ve.getValue(elContext);
} 

public void before(String var) {
FacesContext context = FacesContext.getCurrentInstance();
ELContext elContext = context.getELContext();
ValueExpression ve1 = context.getApplication().getExpressionFactory()
.createValueExpression(elContext,
"#{" var "}", Object.class);
ve1.setValue(elContext, data);
}
  1. 还没有评论.想坐沙发?
  1. 还没有 trackbacks
订阅评论