|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.util.ExpressionEvaluationUtils
public abstract class ExpressionEvaluationUtils
Convenience methods for easy access to the JSP 2.0 ExpressionEvaluator or the ExpressionEvaluatorManager of Jakarta's JSTL implementation.
Automatically detects JSP 2.0 or Jakarta JSTL, preferring the JSP 2.0 mechanism if available. Falls back to throwing an exception on actual EL expressions if none of the two is available.
The evaluation methods check if the value contains "${" before invoking the EL evaluator, treating the value as "normal" expression (that is, a conventional String) 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 don't receive actual EL expressions.
ExpressionEvaluator
,
ExpressionEvaluatorManager
Constructor Summary | |
---|---|
ExpressionEvaluationUtils()
|
Method Summary | |
---|---|
static Object |
evaluate(String attrName,
String attrValue,
Class resultClass,
PageContext pageContext)
Evaluate the given expression to an Object, be it EL or a conventional String. |
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 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExpressionEvaluationUtils()
Method Detail |
---|
public static boolean isExpressionLanguage(String value)
value
- the expression to check
true
if the expression is an EL expression,
false
otherwisepublic static Object evaluate(String attrName, String attrValue, Class resultClass, PageContext pageContext) throws JspException
attrName
- name of the attribute (typically a JSP tag attribute)attrValue
- value of the attributeresultClass
- class that the result should have (String, Integer, Boolean)pageContext
- current JSP PageContext
JspException
- in case of parsing errorspublic static Object evaluate(String attrName, String attrValue, PageContext pageContext) throws JspException
attrName
- name of the attribute (typically a JSP tag attribute)attrValue
- value of the attributepageContext
- current JSP PageContext
JspException
- in case of parsing errorspublic static String evaluateString(String attrName, String attrValue, PageContext pageContext) throws JspException
attrName
- name of the attribute (typically a JSP tag attribute)attrValue
- value of the attributepageContext
- current JSP PageContext
JspException
- in case of parsing errorspublic static int evaluateInteger(String attrName, String attrValue, PageContext pageContext) throws JspException
attrName
- name of the attribute (typically a JSP tag attribute)attrValue
- value of the attributepageContext
- current JSP PageContext
JspException
- in case of parsing errorspublic static boolean evaluateBoolean(String attrName, String attrValue, PageContext pageContext) throws JspException
attrName
- name of the attribute (typically a JSP tag attribute)attrValue
- value of the attributepageContext
- current JSP PageContext
JspException
- in case of parsing errors
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |