如何通过Lotus Notes Java Agent重定向网页? [英] How to redirect webpage by Lotus Notes java agent?
问题描述
用户使用以下URL进入页面:
Users comes to a page by using following URL:
http://myswerver/mydb.nsf/myagent?OpenAgent
现在,我希望该Java代理检查数据库中的内容,如果它满足某些条件,则将用户重定向到另一个页面.如果不是,请加载由myagent构建的主页.这是我的代理代码:
Now I want this Java agent check something in the db and if it meets some conditions then redirect user to another page. If not - load main page that is build by myagent. Here is my agent code:
PrintWriter pw = getAgentOutput();
if(myvar == 1){
pw.flush();
pw.println("Content-Type: text/html");
pw.println("<html><head>");
pw.println("<script>location.href=\"http://www.mypage.com\"</script>");
pw.println("</head></html>");
}
每次重定向时也会加载代理页面的问题.我确实想立即重定向
The problem that it loads agents' page everytime even it redirects then. I do want to redirect immediately
推荐答案
解决方案要容易得多:每当您想要在Web上的Lotus Notes中进行任何重定向时,只需在括号中打印"重定向URL.您的代码可以这样简化:
The solution is much easier: Whenever you want anything to redirect in Lotus Notes in the web, then you simply "print" the redirection url in brackets. Your code can be simplified like this:
PrintWriter pw = getAgentOutput();
if(myvar == 1){
pw.flush();
pw.println("[http://www.mypage.com]");
}
这将立即将您重定向到该URL,而无需先明显加载代理页面".
This will instantly redirect you to the url without visibly loading the "agent- page" first.
这在LotusScript- Agents和
This would work in LotusScript- Agents as well as
print "[http://www.mypage.com]"
这篇关于如何通过Lotus Notes Java Agent重定向网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!