AjaxFormComponentUpdatingBehavior not working in Wicket 8

adi*_*tsu 2 java ajax wicket

I'm switching from Wicket 6 to Wicket 8, and AjaxFormComponentUpdatingBehavior doesn't seem to work anymore.

Example page:

    public HomePage() {
        final Form<Void> form = new Form<>("form");
        final TextField<String> txt = new TextField<>("txt", new Model<>());
        txt.add(new AjaxFormComponentUpdatingBehavior("onchange") {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onUpdate(final AjaxRequestTarget target) {
                System.out.println("update: " + txt.getValue());
            }
        });
        form.add(txt);
        add(form);
    }
Run Code Online (Sandbox Code Playgroud)

and corresponding html:

<form wicket:id="form">
<input wicket:id="txt">
</form>
Run Code Online (Sandbox Code Playgroud)

In Wicket 8.5.0, the onUpdate method never gets called, and there is no error message. In Wicket 6 it works fine. The same thing happens with other component types, e.g. select/DropDownChoice.

Is this a bug? Or what am I doing wrong?

Jer*_*eke 5

on从Wicket 6开始,不赞成使用带有前缀的事件。在Wicket 8中,已删除了对事件的支持。通过更改onchange为,可以使这些组件重新工作change

另请参阅:https : //cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+8.0