import javax.script.*;
public class TestScript {
public static void main(String[] args) throws Exception {
String str = "(a >= 0 && a <= 5)";
System.out.println(TestScript.isInclude(str,str));
}
public static Boolean isInclude(String elValue,String elString){ boolean eval = false;
try {
eval = (boolean) engine.eval(el);
} catch (ScriptException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return eval;
}
}ScriptEngine 对象的eval方法解析逻辑字符串