| java.lang.Object org.springframework.web.util.ExpressionEvaluationUtils
ExpressionEvaluationUtils | abstract public class ExpressionEvaluationUtils (Code) | | Convenience methods for transparent access to JSP 2.0's built-in
javax.servlet.jsp.el.ExpressionEvaluator or the standalone
org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager of Jakarta's JSTL implementation.
Automatically detects JSP 2.0 or Jakarta JSTL, preferring the JSP 2.0
mechanism if available. Also detects the JSP 2.0 API being present but
the runtime JSP engine not actually supporting JSP 2.0, falling back to
the Jakarta JSTL in this case. Throws an exception when encountering actual
EL expressions if neither JSP 2.0 nor the Jakarta JSTL is available.
In the case of JSP 2.0, this class will by default use standard
evaluate calls. If your application server happens to be
inefficient in that respect, consider setting Spring's "cacheJspExpressions"
context-param in web.xml to "true", which will use
parseExpression calls with cached Expression objects instead.
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.
Note: The evaluation methods do not have a runtime dependency on
JSP 2.0 or on Jakarta's JSTL implementation, as long as they are not
asked to process actual EL expressions. This allows for using EL-aware
tags with Java-based JSP expressions instead, for example.
author: Juergen Hoeller author: Alef Arendsen since: 11.07.2003 See Also: javax.servlet.jsp.el.ExpressionEvaluator.evaluate See Also: javax.servlet.jsp.el.ExpressionEvaluator.parseExpression See Also: org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager |
Method Summary | |
public static Object | evaluate(String attrName, String attrValue, Class resultClass, PageContext pageContext) | 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. | 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. | 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. | 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. | public static boolean | isExpressionLanguage(String value) Check if the given expression value is an EL expression. |
EXPRESSION_CACHE_CONTEXT_PARAM | final public static String EXPRESSION_CACHE_CONTEXT_PARAM(Code) | | JSP 2.0 expression cache parameter at the servlet context level
(i.e. a context-param in web.xml ): "cacheJspExpressions".
|
EXPRESSION_PREFIX | final public static String EXPRESSION_PREFIX(Code) | | |
EXPRESSION_SUFFIX | final public static String EXPRESSION_SUFFIX(Code) | | |
evaluate | public static Object evaluate(String attrName, String attrValue, Class resultClass, PageContext pageContext) throws JspException(Code) | | 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) Parameters: attrValue - value of the attribute Parameters: resultClass - class that the result should have (String, Integer, Boolean) Parameters: pageContext - current JSP PageContext the result of the evaluation throws: JspException - in case of parsing errors, also in case of type mismatchif the passed-in literal value is not an EL expression and not assignable tothe result class |
evaluate | public static Object evaluate(String attrName, String attrValue, PageContext pageContext) throws JspException(Code) | | 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) Parameters: attrValue - value of the attribute Parameters: pageContext - current JSP PageContext the result of the evaluation throws: JspException - in case of parsing errors |
evaluateBoolean | public static boolean evaluateBoolean(String attrName, String attrValue, PageContext pageContext) throws JspException(Code) | | 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) Parameters: attrValue - value of the attribute Parameters: pageContext - current JSP PageContext the result of the evaluation throws: JspException - in case of parsing errors |
evaluateInteger | public static int evaluateInteger(String attrName, String attrValue, PageContext pageContext) throws JspException(Code) | | 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) Parameters: attrValue - value of the attribute Parameters: pageContext - current JSP PageContext the result of the evaluation throws: JspException - in case of parsing errors |
evaluateString | public static String evaluateString(String attrName, String attrValue, PageContext pageContext) throws JspException(Code) | | 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) Parameters: attrValue - value of the attribute Parameters: pageContext - current JSP PageContext the result of the evaluation throws: JspException - in case of parsing errors |
isExpressionLanguage | public static boolean isExpressionLanguage(String value)(Code) | | Check if the given expression value is an EL expression.
Parameters: value - the expression to check true if the expression is an EL expression,false otherwise |
|
|