【问题标题】:JSP: Evaluate EL expression in SimpleTagSupport - getExpressionEvaluator deprecated? (Spring MVC)JSP:在 SimpleTagSupport 中评估 EL 表达式 - 不推荐使用 getExpressionEvaluator? (弹簧MVC)
【发布时间】:2013-07-04 14:46:17
【问题描述】:

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

<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。 我该怎么做?

【问题讨论】:

    标签: jsp tags el expression-evaluation


    【解决方案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()

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-02
      • 2020-04-06
      • 1970-01-01
      • 2016-07-10
      • 2014-06-21
      • 1970-01-01
      • 1970-01-01
      • 2010-10-04
      相关资源
      最近更新 更多