我有一个重复控件,它为我生成一个指向不同数据库中文档的链接列表。此任务的特殊之处在于 XPage 在notes 内部浏览器(不是 XPniC)中运行,并在notes 客户端(不是Xpages)中将文档作为真正的notes 文档打开。到目前为止,一切正常。现在我也想在打开文档之前检查文档是否存在。
我的解决方案是一个 xAgent,它检查文档是否存在并重定向到 NotesURL,但我收到以下错误:
Error source
Page Name:/xaOpenDocument.xsp
Exception
Error while executing JavaScript action expression
Script interpreter error, line=25, col=43: Error calling method 'redirect(java.lang.String)' on java class 'com.ibm.xsp.domino.context.DominoExternalContext'
notes://SERVER01@SRV@DE@OU@MyCompany AG/__C1257B6B002A0472.nsf/0/C1257B6B002A0472C12574CD0024E6B9
xAgent 的链接如下所示:
http://SERVER02/dev/release_4/test_xui.nsf/xaOpenDocument.xsp?dbServer=SERVER01%2FSRV%2FDE%2FOU%2FMyCompany+AG&dbPath=dev%5C%5Crelease_4%5C%5Ctest_adr&docUNID=C1257B6B002A0472C12574CD0024E6B9
xAgent 代码如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" rendered="false">
<xp:this.afterPageLoad><![CDATA[#{javascript:var server:string = context.getUrlParameter("dbServer");
var db:string = context.getUrlParameter("dbPath");
var unid:string = context.getUrlParameter("docUNID");
var url:string = "";
var targetDB:NotesDatabase = session.getDatabase(server,db);
var doc:NotesDocument = targetDB.getDocumentByUNID(unid);
if(doc == null){
requestScope.put("targetDocUNID",unid);
println("xaOpendocument targetDocUNID: " + unid);
requestScope.put("dbServer",server);
println("xaOpendocument dbServer: " + server);
requestScope.put("dbPath",db);
println("xaOpendocument dbPath: " + db);
requestScope.put("targetError","Dokument konnte nicht geöffnet werde. \n Document wurde verschoben oder entfernt.");
println("xaOpendocument URL: xpErrorMessage.xsp");
context.redirectToPage("xpErrorMessage.xsp");
}else{
url = sessionUser.getDocumentURL(targetDB,unid);
println("xaOpendocument: Dokument wurde gefunden... Umleiten!");
println("xaOpendocument URL: " + url);
facesContext.getExternalContext().redirect(url);
}}]]></xp:this.afterPageLoad>
</xp:view>
服务器控制台向我显示以下错误行:
30.07.2013 11:17:47 HTTP JVM: xaOpendocument: Dokument wurde gefunden... Umleiten!
30.07.2013 11:17:47 HTTP JVM: xaOpendocument URL: notes://SERVER02@SRV@DE@OU@MyCompany AG/__C1257B6B002A0472.nsf/0/C1257B6B002A0472C12574CD0024E6B9
30.07.2013 11:17:47 HTTP JVM: com.ibm.xsp.webapp.FacesServlet$ExtendedServletException: com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing JavaScript action expression
30.07.2013 11:17:47 HTTP JVM: CLFAD0134E: Exception processing XPage request. For more detailed information, please consult error-log-0.xml located in F:/Lotus/data/domino/workspace/logs
我希望能得到一些有用的帮助——我已经在这个问题上浪费了很多时间。我认为这应该很简单。:/