我需要从类似于此this issue的java bean调用ssjs。问题是,我需要执行的代码来自一个配置文件,并可能看起来像:如何从Java Bean调用ad hoc SSJS
getComponent("xxx").getValue();
我已经建立,做一个版本:
String compute = doc.getItemValueString("SSJSStuff");
String valueExpr = "#{javascript:" + compute + "}";
FacesContext fc = FacesContext.getCurrentInstance();
Application app = fc.getApplication();
ValueBinding vb = app.createValueBinding(valueExpr);
String vreslt = vb.getValue(fc).toString();
,但我得到"Exception in xxx: com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing JavaScript computed expression"
我觉得我很接近,但我没有看到山上..任何想法?
为#4的答案 - 因为该组件在这一点上是不可用正在返回任何对象在XSP生命周期中。我通过将dataSource中的NotesDocument传递给Java Bean方法来解决这个问题,所以我可以反对实际的Notes字段。我将更深入地研究ExpressionEvaluatorImpl,因为它承诺此项目的其他部分。/Newbs – Newbs 2012-04-26 15:57:00
有没有办法像javax.script.ScriptEngine中的put(key,object)一样将对象注入SSJS评估?我想对Java文档集合中的所有文档评估相同的脚本。 – 2013-09-02 15:02:02
@PanuHaaramo:对不起,我不明白你在做什么... – 2013-09-06 09:41:47