【发布时间】:2012-03-09 10:59:12
【问题描述】:
在调用代理时如何在 Xpages 中传递文档上下文?在 Xpage 中,我需要从我的 Xpage 调用带有 documentcontext 的 java 代理,而且我需要将当前文档作为参数传递...
在 Lotuscript 中我们可以很容易地做到这一点而无需保存当前文档,但在 Xpage 中我使用以下代码。document1 是当前文档。
var agent=database.getAgent("AgentName");
agent.runWithDocumentContext(currentDocument.getDocument());
此代码我无法获取当前文档项目的值,但如果我将使用以下代码,
var agent=database.getAgent("AgentName");
document1.save();
agent.runWithDocumentContext(currentDocument.getDocument());
我可以获取当前文档的item值...但是我不想保存文档,不保存文档我需要获取item的item值。
请为此提供任何好的解决方案...
【问题讨论】:
-
不应该吗? : agent.runWithDocumentContext(document1);
-
是的,这会引发错误...之后我尝试了 document1.getDocument() 方法
-
啊哈,我没有看到你的重新编辑。您无法在文档上调用后台代理,因为代理在服务器上运行并且您的文档在前端网站中打开,因此之前尚未在网络上保存过。服务器不知道,你的文档甚至存在...
-
什么触发了你的代码?按钮?
-
您是否尝试过 getDocument(true),是什么将更改的字段从数据源传递到后端文档?
标签: lotus-notes xpages xpages-ssjs