public static boolean evaluate(ValueExpression expression, PageContext pageContext, boolean fallback) { if (expression == null) { return fallback; } Boolean result = (Boolean) expression.getValue(pageContext.getELContext()); return result == null ? fallback : result.booleanValue(); }
public static int evaluate(ValueExpression expression, PageContext pageContext, int fallback) { if (expression == null) { return fallback; } Integer result = (Integer) expression.getValue(pageContext.getELContext()); return result == null ? fallback : result.intValue(); } }
public static boolean evaluate(ValueExpression expression, PageContext pageContext, boolean fallback) { if (expression == null) { return fallback; } Boolean result = (Boolean) expression.getValue(pageContext.getELContext()); return result == null ? fallback : result.booleanValue(); }
public static int evaluate(ValueExpression expression, PageContext pageContext, int fallback) { if (expression == null) { return fallback; } Integer result = (Integer) expression.getValue(pageContext.getELContext()); return result == null ? fallback : result.intValue(); } }
@Override public Object run() throws Exception { ELContextImpl ctx = (ELContextImpl) pageContext.getELContext(); ctx.setFunctionMapper(functionMap); ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType); return ve.getValue(ctx); } });
/** * Create a value expression. * * @param pageContext the context in which the expression will be parsed * @param expression the expression * @param expectedType the expected type of result * @return a parsed expression */ public static ValueExpression createValueExpression(PageContext pageContext, String expression, Class<?> expectedType) { ExpressionFactory factory = getExpressionFactory(pageContext); return factory.createValueExpression(pageContext.getELContext(), expression, expectedType); }
protected void prepare() throws JspTagException { if (items instanceof ValueExpression) { deferredExpression = (ValueExpression) items; items = deferredExpression.getValue(pageContext.getELContext()); } if (!(items instanceof String)) { throw new JspTagException( Resources.getMessage("FORTOKENS_BAD_ITEMS")); } st = new StringTokenizer((String)items, delims); }
public Object run() throws Exception { ELContextImpl ctx = (ELContextImpl) pageContext.getELContext(); ctx.setFunctionMapper(new FunctionMapperImpl(functionMap)); ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType); return ve.getValue(ctx); } });
protected void prepare() throws JspTagException { if (items instanceof ValueExpression) { deferredExpression = (ValueExpression) items; items = deferredExpression.getValue(pageContext.getELContext()); } if (!(items instanceof String)) { throw new JspTagException( Resources.getMessage("FORTOKENS_BAD_ITEMS")); } st = new StringTokenizer((String)items, delims); }
protected void prepare() throws JspTagException { if (items instanceof ValueExpression) { deferredExpression = (ValueExpression) items; items = deferredExpression.getValue(pageContext.getELContext()); } if (!(items instanceof String)) { throw new JspTagException( Resources.getMessage("FORTOKENS_BAD_ITEMS")); } st = new StringTokenizer((String)items, delims); }
protected void prepare() throws JspTagException { if (items instanceof ValueExpression) { deferredExpression = (ValueExpression) items; items = deferredExpression.getValue(pageContext.getELContext()); } if (!(items instanceof String)) { throw new JspTagException( Resources.getMessage("FORTOKENS_BAD_ITEMS")); } st = new StringTokenizer((String)items, delims); }
@Override public Object run() throws Exception { ELContextImpl ctx = (ELContextImpl) pageContext.getELContext(); ctx.setFunctionMapper(new FunctionMapperImpl(functionMap)); ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType); return ve.getValue(ctx); } });
public static ValueExpression getValueExpression(String expression, PageContext pageContext, Class expectedType, FunctionMapper functionMap) { // ELResolvers are not used in createValueExpression ELContextImpl elctxt = (ELContextImpl) pageContext.getELContext(); elctxt.setFunctionMapper(functionMap); ExpressionFactory expFactory = getExpressionFactory(pageContext); return expFactory.createValueExpression(elctxt, expression, expectedType); }
public static ValueExpression getValueExpression(String expression, PageContext pageContext, Class expectedType, FunctionMapper functionMap) { // ELResolvers are not used in createValueExpression ELContextImpl elctxt = (ELContextImpl)pageContext.getELContext(); elctxt.setFunctionMapper(functionMap); ExpressionFactory expFactory = getExpressionFactory(pageContext); return expFactory.createValueExpression(elctxt, expression, expectedType); }
public static void setValueVariable(PageContext pageContext, String variable, ValueExpression expression) { ELContextImpl elctxt = (ELContextImpl) pageContext.getELContext(); elctxt.getVariableMapper().setVariable(variable, expression); }
public static void setValueVariable(PageContext pageContext, String variable, ValueExpression expression) { ELContextImpl elctxt = (ELContextImpl)pageContext.getELContext(); elctxt.getVariableMapper().setVariable(variable, expression); }
private void setProperty(Object value) throws JspException { try { ELContext env = pageContext.getELContext(); Object target = targetExpr.evalObject(env); String property = propertyExpr.evalString(env); Expr.setProperty(target, property, value); } catch (Exception e) { throw new JspException(e); } }
/** * Evaluates an expression. */ public Object evaluate(VariableResolver resolver) throws ELException { if (resolver instanceof PageContext) return _expr.evalObject(((PageContext) resolver).getELContext()); else return _expr.evalObject(new ELContextAdapter(resolver)); } }
@Override public ELContext getELContext() { if (elContext == null) { elContext = new ELContextWrapper(rootJspCtxt.getELContext(), jspTag, this); JspFactory factory = JspFactory.getDefaultFactory(); JspApplicationContext jspAppCtxt = factory.getJspApplicationContext(servletContext); if (jspAppCtxt instanceof JspApplicationContextImpl) { ((JspApplicationContextImpl) jspAppCtxt).fireListeners(elContext); } } return elContext; }
@Override public ELContext getELContext() { if (elContext == null) { elContext = new ELContextWrapper(rootJspCtxt.getELContext(), jspTag, this); JspFactory factory = JspFactory.getDefaultFactory(); JspApplicationContext jspAppCtxt = factory.getJspApplicationContext(servletContext); if (jspAppCtxt instanceof JspApplicationContextImpl) { ((JspApplicationContextImpl) jspAppCtxt).fireListeners(elContext); } } return elContext; }