gpt4 book ai didi

java - Wicket 口.Ajax : Cannot bind a listener for event "click" on element "radioGroup1d" because the element is not in the DOM

转载 作者:行者123 更新时间:2023-12-02 02:46:51 45 4
gpt4 key购买 nike

我在 apache-wicket-7 中有一个带有 RadioGroup 的页面。我想用ajax调用后端Page类中的方法。为此,我添加:

AjaxFormChoiceComponentUpdatingBehavior

代码:

this.listInput = new RadioGroup<T>("radioGroup", this.model);
this.listInput.add(new AjaxFormChoiceComponentUpdatingBehavior() {

private static final long serialVersionUID = 1L;

@Override
protected void onUpdate(AjaxRequestTarget arg0) {
System.out.println("The selected value is " + getComponent().getDefaultModelObjectAsString());
}
});

RadioGroup 组件在早期的 ajax 调用后变得可见,因此它也是异步渲染的。但是当 wicket 尝试渲染组件时,会出现错误消息:

Wicket.Ajax:  Cannot bind a listener for event "click" on element "radioGroup1d" because the element is not in the DOM

添加:

setOutputMarkupPlaceholderTag(true)

什么也不做。如何解决这个问题?

问候,马特乌斯

最佳答案

确保您不使用<wicket:cotainer>在 HTML 模板中找到它。这些不会被渲染。

关于java - Wicket 口.Ajax : Cannot bind a listener for event "click" on element "radioGroup1d" because the element is not in the DOM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44439388/

45 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com