JSP getVariableResolver() is deprecated, what is the right way in JSP 2.2?

el, java, jsp

Solution

According to the Javadoc, the new way of getting the variable resolver is to do `jspContext.getELContext().getELResolver()`; as a PageContext is a JspContext, you could change your line to `<%=pageContext.getELContext().getELResolver().resolveVariable("varName")`%>.

If all you want is to resolve a variable you should probably be using EL-syntax instead: `${varName}`.

Problem

I use this code but is deprecated, can you help me to port it to JSP 2.2 ``` <%= pageContext.getVariableResolver().resolveVariable("varName")%> ```

Original source