Here’s what I want to do:
Map<String, Object> model = new Hashmap<String, Object>();
model.put("a", "abc");
model.put("b", new Hashmap<String, Object>());
model.get("b").put("c", "xyz");
String el = "A is ${a} and C is ${b.c}";
assertEquals(elEval(el, model), "A is abc and C is xyz");
Is this possible?
Yes , it is possible , you can refer to this link for more information . As you can see , in order to use the EL expression standalone , you would have to implement several classes such as the
javax.el.ELContext. I found JUEL , which is one of the implementation of the EL expression , already provides very nice implementations of these classes in thede.odysseus.el.utilpackage.I have played around with JUEL .Here is my testing code for your reference: