title: Alternatives to Spring's deprecated ExpressionEvaluationUtils evaluate methods?
body: <p>Since the class:<a href="http://docs.spring.io/spring/docs/3.2.6.RELEASE/javadoc-api/org/springframework/web/util/ExpressionEvaluationUtils.html" rel="noreferrer">org.springframework.web.util.ExpressionEvaluationUtils</a>
  is deprecated since Spring 3.x release, I am looking for another alternative for EL expression evaluation in my java code.</p>
  
  <p>After reading JSP 2.x documentation, I did manage to construct an alternative method: </p>
  
  <pre><code>import javax.el.ELContext;
  import javax.el.ExpressionFactory;
  import javax.el.ValueExpression;
  import javax.servlet.jsp.JspApplicationContext;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.JspFactory;
  import javax.servlet.jsp.PageContext;
  
  
  public class ExpressionEvaluationUtils {
  
  
      public static Object evaluate(String exp, Class&lt;?&gt; resultClass, PageContext pageContext)
          throws JspException {
  
          if (pageContext == null){
              return exp;
          }
          ELContext elContext =  pageContext.getELContext();
          JspFactory jf = JspFactory.getDefaultFactory();
          JspApplicationContext jac = jf
                           .getJspApplicationContext(pageContext.getServletContext());
          ExpressionFactory ef = jac.getExpressionFactory();
          ValueExpression val = ef.createValueExpression(elContext, exp, resultClass);
          return val.getValue(elContext);
      }
  
  }
  </code></pre>
  
  <p>Can you suggest more alternatives to my implementation?</p>