List of usage examples for javax.servlet.jsp PageContext getExpressionEvaluator
public abstract ExpressionEvaluator getExpressionEvaluator();
From source file:io.undertow.test.jsp.expression.ExpressionJspTestCase.java
public static void evaluate(JspWriter out, PageContext pc, String qualifiedMethodExpression, String unqualifiedMethodExpression, String variableExpression) throws Exception { assert pc != null; TSFunctionMapper mapper = new TSFunctionMapper(); ExpressionEvaluator eval = pc.getExpressionEvaluator(); VariableResolver resolver = pc.getVariableResolver(); assert eval != null : "Unable to obtain ExpressionEvaluator"; Expression expr = eval.parseExpression(qualifiedMethodExpression, java.lang.String.class, mapper); assert expr != null; String result = (String) expr.evaluate(resolver); if (result != null) { if (result.equals("string")) { Expression expr2 = eval.parseExpression(variableExpression, javax.servlet.jsp.PageContext.class, null);//from www . j av a 2 s . c o m if (expr2 != null) { PageContext pageContext = (PageContext) expr2.evaluate(resolver); if (pageContext != pc) { out.println("Test FAILED. Resolution didn't return expected value."); out.println("PageContext returned is not the same instance as expected."); } Expression expr3 = eval.parseExpression(unqualifiedMethodExpression, java.lang.String.class, mapper); if (expr3 != null) { result = (String) expr3.evaluate(resolver); if (result != null) { if (result.equals("string")) { out.println("Test PASSED"); } else { out.println("Test FAILED. (l3) Expression evaluation returned unexpected value."); out.println("Expected 'string', received '" + result + "'"); } } else { out.println("Test FAILED. (l3) Expression evaluation returned null."); } } else { out.println("Test FAILED. (l3) ExpressionEvaluator.parseExpression" + " returned null."); } } else { out.println("Test FAILED. (l2) ExpressionEvaluator returned null."); } } else { out.println("Test FAILED. (l1) Expression evaluation returned unexpected result."); out.println("Expected 'string', Received '" + result + "'"); } } else { out.println("Test FAILED. (l1) Expression evaluation returned null."); } }
From source file:org.emonocot.portal.view.Functions.java
public static String evaluate(String expressionString, PageContext pageContext) throws ELException { return (String) pageContext.getExpressionEvaluator().evaluate(expressionString, String.class, pageContext.getVariableResolver(), null); }