【问题标题】:How to set label to StatelessAjaxSubmitLink?如何将标签设置为 StatelessAjaxSubmitLink?
【发布时间】:2021-02-21 14:49:53
【问题描述】:

我需要使用 wicketstuff 的 StatelessAjaxSubmitLink 但我找不到任何方法来自定义默认标签(“提交查询”)。该类不继承 setLabel() 方法。有没有办法解决这个问题?

【问题讨论】:

    标签: label wicket wicketstuff


    【解决方案1】:

    我猜你正在寻找setBody

    更新

    如果您使用带有 HTML 标签 <input type="submit"/> 的组件,那么您应该使用 value 属性来设置您想要的标签。在 Wicket 中使用 AttributeAppender:

    yourLink.add(AttributeAppender.append("value", "foo bar"));

    https://ci.apache.org/projects/wicket/guide/7.x/single.html#_modifing_tag_attributes

    【讨论】:

    • 我尝试使用它,但出现运行时错误,可能是因为我试图将它与输入一起使用? Expected close tag for '<input wicket:id="submitButton" type="submit" class="btn get-started-button">' Possible attempt to embed component(s) '<input wicket:id="submitButton" type="submit" class="btn get-started-button">' in the body of this component which discards its body
    • 我已经为你的具体情况更新了答案。看看吧!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-07
    • 2021-02-25
    • 2017-10-09
    • 1970-01-01
    • 2023-01-09
    相关资源
    最近更新 更多