Script工具-ScriptUtil
介绍
使用
ScriptUtil.eval执行Javascript脚本,参数为脚本字符串。
栗子:
ScriptUtil.eval("print('Script test!');");
ScriptUtil.compile编译脚本,返回一个CompiledScript对象
栗子:
CompiledScript script = ScriptUtil.compile("print('Script test!');");try {script.eval();} catch (ScriptException e) {throw new ScriptRuntimeException(e);}
