@Override public Object getValue(FacesContext context) throws EvaluationException, PropertyNotFoundException { Object result = null; try { ScriptEngine engine = (ScriptEngine) getScopeMap().get("_" + language + "ScriptEngine"); if (engine == null) { engine = GenericBindingFactory.createScriptEngine(language); getScopeMap().put("_" + language + "ScriptEngine", engine); } includeScriptLibraries(engine); result = engine.eval(this.content); } catch (ScriptException se) { throw new EvaluationException(se); } return result; }
@Override public Object invoke(FacesContext context, Object[] arg1) throws EvaluationException, MethodNotFoundException { Object result = null; try { ScriptEngine engine = (ScriptEngine) getScopeMap().get("_" + language + "ScriptEngine"); if (engine == null) { engine = GenericBindingFactory.createScriptEngine(language); getScopeMap().put("_" + language + "ScriptEngine", engine); } includeScriptLibraries(engine); result = engine.eval(this.content); } catch (ScriptException se) { throw new EvaluationException(se); } if (!(result instanceof Serializable)) { return result.toString(); } return result; }