Java Vaadin 从按钮单击重定向到 URL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24012682/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Vaadin redirecting to a URL from button click
提问by user3702643
I have searched for a long time, but I really cannot figure this out.
我已经搜索了很长时间,但我真的无法弄清楚。
How do I redirect the user to a new external link (e.g. www.google.com) when they click a button in Vaadin?
当用户单击 Vaadin 中的按钮时,如何将用户重定向到新的外部链接(例如www.google.com)?
The only thing I have managed to do so far is to put the link into a link
到目前为止,我唯一能做的就是将链接放入链接中
Link link = new Link("link", new ExternalResource("http://www.google.com"));
Can anyone help me out with this please?
任何人都可以帮我解决这个问题吗?
采纳答案by VH-NZZ
getUI().getPage().setLocation("http://www.google.com");
References: Page (Vaadin 7.2.1 API)and Vaadin application lifecycle (Book of Vaadin).
参考资料:Page(Vaadin 7.2.1 API)和Vaadin 应用程序生命周期(Book of Vaadin)。