Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用此代码但已弃用,您能帮我将其移植到 JSP 2.2
<%= pageContext.getVariableResolver().resolveVariable("varName")%>
根据Javadoc,获取变量解析器的新方法是jspContext.getELContext().getELResolver():由于 PageContext 是 JspContext,您可以将您的行更改为<%=pageContext.getELContext().getELResolver().resolveVariable("varName")%>。
jspContext.getELContext().getELResolver()
<%=pageContext.getELContext().getELResolver().resolveVariable("varName")
如果您只想解析一个变量,您可能应该使用EL 语法:${varName}.
${varName}