public abstract class

ExpressionEvaluationUtils

extends Object
java.lang.Object
   ↳ org.springframework.web.util.ExpressionEvaluationUtils

Class Overview

Convenience methods for accessing JSP 2.0's javax.servlet.jsp.el.ExpressionEvaluator.

The evaluation methods check if the value contains "${" before invoking the EL evaluator, treating the value as "normal" expression (i.e. a literal String value) else.

See Also
  • javax.servlet.jsp.el.ExpressionEvaluator#evaluate

Summary

Constants
String EXPRESSION_PREFIX
String EXPRESSION_SUFFIX
Public Constructors
ExpressionEvaluationUtils()
Public Methods
static Object evaluate(String attrName, String attrValue, PageContext pageContext)
Evaluate the given expression (be it EL or a literal String value) to an Object.
static Object evaluate(String attrName, String attrValue, Class resultClass, PageContext pageContext)
Evaluate the given expression (be it EL or a literal String value) to an Object of a given type,
static boolean evaluateBoolean(String attrName, String attrValue, PageContext pageContext)
Evaluate the given expression (be it EL or a literal String value) to a boolean.
static int evaluateInteger(String attrName, String attrValue, PageContext pageContext)
Evaluate the given expression (be it EL or a literal String value) to an integer.
static String evaluateString(String attrName, String attrValue, PageContext pageContext)
Evaluate the given expression (be it EL or a literal String value) to a String.
static boolean isExpressionLanguage(String value)
Check if the given expression value is an EL expression.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String EXPRESSION_PREFIX

Constant Value: "${"

public static final String EXPRESSION_SUFFIX

Constant Value: "}"

Public Constructors

public ExpressionEvaluationUtils ()

Public Methods

public static Object evaluate (String attrName, String attrValue, PageContext pageContext)

Evaluate the given expression (be it EL or a literal String value) to an Object.

Parameters
attrName name of the attribute (typically a JSP tag attribute)
attrValue value of the attribute
pageContext current JSP PageContext
Returns
  • the result of the evaluation
Throws
in case of parsing errors
JspException

public static Object evaluate (String attrName, String attrValue, Class resultClass, PageContext pageContext)

Evaluate the given expression (be it EL or a literal String value) to an Object of a given type,

Parameters
attrName name of the attribute (typically a JSP tag attribute)
attrValue value of the attribute
resultClass class that the result should have (String, Integer, Boolean)
pageContext current JSP PageContext
Returns
  • the result of the evaluation
Throws
in case of parsing errors, also in case of type mismatch if the passed-in literal value is not an EL expression and not assignable to the result class
JspException

public static boolean evaluateBoolean (String attrName, String attrValue, PageContext pageContext)

Evaluate the given expression (be it EL or a literal String value) to a boolean.

Parameters
attrName name of the attribute (typically a JSP tag attribute)
attrValue value of the attribute
pageContext current JSP PageContext
Returns
  • the result of the evaluation
Throws
in case of parsing errors
JspException

public static int evaluateInteger (String attrName, String attrValue, PageContext pageContext)

Evaluate the given expression (be it EL or a literal String value) to an integer.

Parameters
attrName name of the attribute (typically a JSP tag attribute)
attrValue value of the attribute
pageContext current JSP PageContext
Returns
  • the result of the evaluation
Throws
in case of parsing errors
JspException

public static String evaluateString (String attrName, String attrValue, PageContext pageContext)

Evaluate the given expression (be it EL or a literal String value) to a String.

Parameters
attrName name of the attribute (typically a JSP tag attribute)
attrValue value of the attribute
pageContext current JSP PageContext
Returns
  • the result of the evaluation
Throws
in case of parsing errors
JspException

public static boolean isExpressionLanguage (String value)

Check if the given expression value is an EL expression.

Parameters
value the expression to check
Returns
  • true if the expression is an EL expression, false otherwise