title: Java: How to evaluate an EL expression - standalone (outside any web framework) without implementing interfaces?
body: <p>I'd like to use EL in my application. But I can't find any howto. I usually end up needing some interface for which I don't have an implementation.</p>
  
  <p>I have a map of objects, and I want a string expression like Hello, <code>${person.name}</code> to be evaluated to a string.</p>
  
  <p>How can I achieve that, using any of Commons EL, javax.el, OGNL, or such? Must be a standalone library.</p>
  
  <p>And I <em>know</em> <a href="https://stackoverflow.com/questions/91692/jstl-jsp-el-expression-language-in-a-non-jsp-standalone-context">Java: using EL outside J2EE</a>, and have seen <a href="https://stackoverflow.com/questions/91692/jstl-jsp-el-expression-language-in-a-non-jsp-standalone-context">JSTL/JSP EL (Expression Language) in a non JSP (standalone) context</a>. That is not what I'm looking for.</p>
  
  <p>What I am looking for is an example of what dependency to add, and then how to initialize a parser which will have:</p>
  
  <pre><code>private static String evaluateEL( String expr, Map&lt;String, String&gt; properties );
  </code></pre>
  
  <p>and allow me to do:</p>
  
  <pre><code>String greet = evaluateEL("Hello ${person.name}", 
       new HashMap(){{
         put("person", new Person("Ondra"));
       }}
  );
  </code></pre>
  
  <p>And I need it to use some rational value, e.g. <code>""</code> on <code>null</code> instead of throwing NPE or so.</p>