作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 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/
我是一名优秀的程序员,十分优秀!