Vaadin在新标签中打开链接 [英] Vaadin open link in new tab

查看:190
本文介绍了Vaadin在新标签中打开链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Vaadin编写了以下代码。当用户点击按钮时,代码会打开页面 www.google.com

I have the following piece of code that I wrote using Vaadin. The code opens the page www.google.com when the user clicks the button.

我的问题是在那里我可以用任何方式指定在新标签页中打开页面吗?

My question is is there any way for me to specify that the page is to be opened in a new tab?

谢谢。

button.addClickListener(new Button.ClickListener() {
    public void buttonClick(ClickEvent event) {
        getUI().getPage().setLocation("http://www.google.com");
    }
});


推荐答案

getUI().getPage().open("http://www.google.com", "_blank");

此处 _blank 窗口名称非常重要。请注意,您可能还有的浏览器可能会在新窗口中打开资源。

The _blank window name is important here. Beware that you may also have browsers that will might open the resource in a new window instead.

还有另一个签名 open()方法,即

There is also another signature to the open() method, i.e.

open(String url, String windowName, boolean tryToOpenAsPopup) 

可能适合账单。 HTH。

that may fit the bill. HTH.

参考文献:页面(Vaadin 7.2.1 API)

这篇关于Vaadin在新标签中打开链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆