简体   繁体   English

呼叫代理将对话框发送给用户xpages

[英]calling agent send dialog box to user xpages

how to send error message to user from agent when using xpages? 使用xpages时如何从代理向用户发送错误消息?

Here the detail engine: 1. The xpages contains a button. 这里是详细信息引擎:1. xpages包含一个按钮。 when the button was clicked then it will call the agent to process the context info 2. On processing the agent, is it possible to send warning message to user (dialog box)? 当单击按钮时,它将调用代理处理上下文信息。2.处理代理时,是否可以向用户发送警告消息(对话框)? If yes, What command for send it? 如果是,发送什么命令?

Thanks 谢谢

An agent cannot directly interact with XPages. 代理不能直接与XPages交互。 One method would be to write output to a control document and for XPages to pick up that control document and put the message in a requestScope variable to be displayed on the page. 一种方法是将输出写入控制文档中,然后让XPages拾取该控制文档,然后将消息放入requestScope变量中以在页面上显示。

I agree with Paul. 我同意保罗的看法。 Just adding a small snippet here for you to start: 只需在此处添加一个小片段即可开始:

var agentName:String = "agentName";
var agent:NotesAgent = database.getAgent(agentName);
if (agent != null) 
{
var doc:NotesDocument = document1.getDocument() // assuming datasource name is document1
agent.runWithDocumentContext(doc); 
/* 
In your agent you process a document with particular form and say a unique id of the passed 
document context 
*/
var v:NotesView = database.getView("warningView"); // For eg. stored in a warning view
var warningDocument:NotesDocument = v.getDocumentByKey(doc.getUniversalID());
// You can process the document according to your needs then ( you can do later step after your dialog is opened)
} 
else 
{
// throw and error message
}

Hope this helps. 希望这可以帮助。

Chintan and Paul are correct. 金丹和保罗是正确的。 Using the technique described in this article you can capture all print output from an agent and use that in the XPage. 使用本文中介绍的技术您可以捕获代理程序的所有打印输出,并在XPage中使用它们。 However.... 然而....

This is an excellent opportunity to pay down some technical debt and transform your agent into a bean. 这是偿还一些技术债务并将您的代理商转变为Bean的绝佳机会。 If it is well written, it should be easy. 如果写得好,应该很容易。 If its not, then you clean it up 如果不是,则将其清理干净

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM