在浏览器中重定向外部URL [英] redirect external url in browser
本文介绍了在浏览器中重定向外部URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从动作类中获取某个网址后,我想重定向该网址[https://api.login.yahoo.com/oauth/v2/request_auth?oauth_token=abcdefg],然后在浏览器中自动显示该网址.但是,尽管我正确地从action类传递了url,但现在我收到了No Action Mapped 404消息.
After I get a certain url from my action class, I want to redirect that url [https://api.login.yahoo.com/oauth/v2/request_auth?oauth_token=abcdefg ] and show that url in browser automatically. But now I am getting No Action Mapped 404 message , although I passed url from action class correctly .
public String getMail(){
try { //some code
url = accessToken.getCallbackUrl();
if(url != null){
return "redirect";
}
return "input";
} catch (UnsupportedOperationException e) {
return "input";
}
}
<action name="getMail" method="getMail"
class="test.MailAction">
<result name="input">/index.jsp</result>
<result name="redirect" type="redirect">${url}</result>
</action>
推荐答案
我只是缺少getter和URL的setter.现在可以使用了:D
I am just missing getter , setter for url. Now just works :D
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
这篇关于在浏览器中重定向外部URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文