We have some JavaScript code templates that we need to interpolate server-side with code like:
var version = ${appVersion};
I thought MVEL would be suitable to this, but it appears to be too smart:
String input = "foo()";
assertEquals(input, MVEL.evalToString(input));
barfs with:
[Error: no such method or function: foo] [Near : {... foo( ....}] ^ [Line: 1, Column: 0] at org.mvel2.PropertyAccessor.getMethod(PropertyAccessor.java:843) at org.mvel2.PropertyAccessor.getNormal(PropertyAccessor.java:203)
is MVEL overkill for simple var interpolation? If so, should I just write my own, or are there any java libs that do simple variable and POJO interpolation?
thanks -nikita