jstl标签中的el
在路径org.apache.taglibs.standard.lang.support下,有个叫 ExpressionEvaluatorManager.evaluate 的方法,当el表达式作为入参时,调用这个方法,在tag内即可自动把el表达式转化。
ExpressionEvaluatorManager.evaluate有四个参数。第一个表示tag的名字,在取el表达式出错时使用。一般和属性名
字相同。第二个要求字符串,通常简单调用输入对象的toString方法。第三个是类,通常用Object.class。第四个用this即可,第五个是
pageContext变量。
页面中的el
在org.apache.jasper.runtime包中,有一个类用来实现PageContext并且解析EL.
public class PageContextImpl
extends PageContext
proprietaryEvaluate
public static java.lang.Object proprietaryEvaluate(java.lang.String expression,
java.lang.Class expectedType,
PageContext pageContext,
ProtectedFunctionMapper functionMap,
boolean escape)
throws ELException
Proprietary method to evaluate EL expressions. XXX - This method should go away once the EL interpreter moves out of JSTL and into its own project. For now, this is necessary because the standard machinery is too slow.
参数:
expression - The expression to be evaluated
expectedType - The expected resulting type
pageContext - The page context
functionMap - Maps prefix and name to Method
返回:
The result of the evaluation
抛出:
ELException
例如:
(java.lang.String)org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${param[/"usern/"] }", java.lang.String.class,
(PageContext)_jspx_page_context, null, false)