Class ExpressionUtil


  • public class ExpressionUtil
    extends java.lang.Object
    Helper functions for working with EL expressions.
    • Constructor Detail

      • ExpressionUtil

        public ExpressionUtil()
    • Method Detail

      • createValueExpression

        public static ValueExpression createValueExpression​(PageContext pageContext,
                                                            java.lang.String expression,
                                                            java.lang.Class<?> expectedType)
        Create a value expression.
        Parameters:
        pageContext - the context in which the expression will be parsed
        expression - the expression
        expectedType - the expected type of result
        Returns:
        a parsed expression
      • getExpressionFactory

        public static ExpressionFactory getExpressionFactory​(PageContext pageContext)
        Return the JSP's ExpressionFactory.
        Parameters:
        pageContext - the context for the JSP
        Returns:
        the ExpressionFactory to use for EL expressions in that JSP
      • evaluate

        public static <T> T evaluate​(ValueExpression expression,
                                     PageContext pageContext)
        Evaluate a value expression. To support optional attributes, if the expression is null then null will be returned.
        Type Parameters:
        T - the expected type of the expression
        Parameters:
        expression - the expression
        pageContext - the context for the JSP
        Returns:
        the result of evaluating the expression