import org.mvel2.MVEL;
public class MVELEvalTst {
public static void main(String[] args) {
String name = "xxx";
Object eval = MVEL.eval("myName=='xxx'",name);
System.out.println(eval);
}
}
这是我的简单 eval 表达式。当我运行它时,得到以下异常。有没有人遇到过这个?请帮忙。
Exception : Exception in thread "main" [Error: could not access: myName; in class: java.lang.String]
[Near : {... myName=='xxx' ....}]
^
[Line: 1, Column: 1]
at org.mvel2.PropertyAccessor.getBeanProperty(PropertyAccessor.java:680)