本文介绍了单击按钮时打开新标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
限时送ChatGPT账号..使用 wicket 我想在单击按钮或链接时打开一个新选项卡,我该如何实现?
using wicket I want to open a new tab when a button or link is clicked, how can I achieve it?
我设法做的是在这样的弹出窗口中打开它:
what I have managed to do is to open it in a pop up like this:
PopupSettings popupSettings = new PopupSettings("popuppagemap").setLeft(0).setHeight(500).setWidth(500).setHeight(0);
// Popup example
final Link<Void> setPopupSettings = new BookmarkablePageLink<Void>("searchBtn", HomePage.class)
.setPopupSettings(popupSettings);
但这会在新窗口中打开它.
but this opens it in a new window.
推荐答案
在新标签页中打开链接没问题:只需在链接中添加 'target="_blank"' 即可.
no problem to open a link in a new tab: just add 'target="_blank"' to the link.
final Link<Void> link = new BookmarkablePageLink<Void>("link", HomePage.class){
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
tag.put("target", "_blank");
}
};
add(link);
这篇关于单击按钮时打开新标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论