1

我有一个扩展 javax.servlet.jsp.tagext 的标记类。简单标签支持。我想在评估表达式语言之前处理它的主体,所以我有:

<body-content>tagdependent</body-content>

在我的 .tld 文件中。

在用身体做完我的事情之后,我想处理 EL。目前我使用这样的东西:

    VariableResolver variableResolver = getJspContext().getVariableResolver();
    Object evaluatedCode = null;
    try {
        evaluatedCode = getJspContext().getExpressionEvaluator().evaluate( snippetCode, String.class, variableResolver, null);
    } catch (ELException e) {
        throw new IllegalStateException( e );
    }

但是文档说getVariableResolvergetExpressionEvaluator弃用

我想正确的方法是使用ELContext。我怎么做?

4

1 回答 1

1

已弃用。从 JSP 2.1 开始,由 JspApplicationContext.getExpressionFactory() 取代

请参阅 - http://docs.oracle.com/cd/E17802_01/products/products/jsp/2.1/docs/jsp-2_1-pfd2/javax/servlet/jsp/JspContext.html#getExpressionEvaluator()

于 2015-09-18T16:49:39.290 回答