Redirect 重定向显示错误“;无法创建页面";

Redirect 重定向显示错误“;无法创建页面";,redirect,xpages,Redirect,Xpages,我得到了一个包含按钮的小xpage,其中包含以下点击事件: context.redirectToPage("http://server:8080/AWM.nsf/viewAllDocuments.xsp", false); 单击按钮后,我立即看到以下错误消息: Error while executing JavaScript action expression Script interpreter error, line=1, col=9: [TypeError] Exception occu

我得到了一个包含按钮的小xpage,其中包含以下点击事件:

context.redirectToPage("http://server:8080/AWM.nsf/viewAllDocuments.xsp", false);
单击按钮后,我立即看到以下错误消息:

Error while executing JavaScript action expression Script interpreter error, line=1, col=9: [TypeError] Exception occurred calling method XSPContext.redirectToPage(string, boolean)
com.ibm.xsp.page.PageNotFoundException: Could not create the page /http://server:8080/AWM.nsf/viewAllDocuments.xsp because the class xsp.http_003a._002fserver_003a8080.awm.nsf.ViewAllDocuments could not
be found. Please check your spelling.
com.ibm.xsp.page.PageNotFoundException: Could not create the page /http://server:8080/AWM.nsf/viewAllDocuments.xsp because the class    xsp.http_003a._002fserver_003a8080.awm.nsf.ViewAllDocuments could not
be found. Please check your spelling. Could not create the page /http://server.de:8080/AWM.nsf/viewAllDocuments.xsp because the class
xsp.http_003a._002fserver_003a8080.awm.nsf.ViewAllDocuments could not be found. Please check your spelling. Cannot find class    xsp.http_003a._002fserver_003a8080.awm.nsf.ViewAllDocuments in NSF
我试图重建数据库并进行了清理,但没有任何更改。 xpage viewAllDocuments.xsp存在,如果复制错误消息的路径并尝试直接打开该页面,则可以正常工作


有人能在这里给我一个提示吗?

尝试通过删除
false
的第二个参数或将其设置为
true
来更改
redirectToPage
的代码。这应该起作用:

context.redirectToPage("http://server:8080/AWM.nsf/viewAllDocuments.xsp")
或者你可以这样写:

facesContext.getExternalContext().redirect("http://server:8080/AWM.nsf/viewAllDocuments.xsp")
当您将第二个参数设置为
false
时,重定向会在服务器上发生,因此您必须编写类似的内容才能使其正常工作(这假设
viewAllDocuments.xsp
位于同一数据库中):

当重定向发生在服务器上时,浏览器上的URL不会更新,但页面会更新


有关更多信息,请参阅和。

尝试通过删除
false
的第二个参数或将其设置为
true
来更改
redirectToPage
的代码。这应该起作用:

context.redirectToPage("http://server:8080/AWM.nsf/viewAllDocuments.xsp")
或者你可以这样写:

facesContext.getExternalContext().redirect("http://server:8080/AWM.nsf/viewAllDocuments.xsp")
当您将第二个参数设置为
false
时,重定向会在服务器上发生,因此您必须编写类似的内容才能使其正常工作(这假设
viewAllDocuments.xsp
位于同一数据库中):

当重定向发生在服务器上时,浏览器上的URL不会更新,但页面会更新


有关详细信息,请参阅和。

将第二个参数设置为false(与您所做的一样),显然会尝试将新URL解释为相对于当前URL的资源(因此错误会提到“/http:/…”)

将第二个参数设置为true,新url将附加到当前url:如果您当前在

http://myserver/mydb.nsf/mypage.xsp
然后url被解析为

http://myserver/mydb.nsf/http://newserver/newpath.html.xsp
至少在我的测试服务器(8.5.3)上的测试数据库中发生了这种情况。不知道是否有办法防止这种情况发生;我通常使用链接控件(如果它必须看起来像按钮,没问题:插入一个看起来像按钮的图像),或者使用客户端脚本,如中所示

location.href="http://newserver/newresource"

将第二个参数设置为false(就像您所做的那样),显然会尝试将新URL解释为相对于当前URL的资源(因此错误会提到“/http:/…”)

将第二个参数设置为true,新url将附加到当前url:如果您当前在

http://myserver/mydb.nsf/mypage.xsp
然后url被解析为

http://myserver/mydb.nsf/http://newserver/newpath.html.xsp
至少在我的测试服务器(8.5.3)上的测试数据库中发生了这种情况。不知道是否有办法防止这种情况发生;我通常使用链接控件(如果它必须看起来像按钮,没问题:插入一个看起来像按钮的图像),或者使用客户端脚本,如中所示

location.href="http://newserver/newresource"

就这样!使用相同的重定向而不使用第二个参数是有效的!就这样!使用相同的重定向而不使用第二个参数是有效的!