单击按钮时打开新标签

编程入门 行业动态 更新时间:2024-10-19 14:35:20
本文介绍了单击按钮时打开新标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-26 03:11:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1128972.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单击   开新   按钮   标签

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!