我试图在wicket框架中获取dropdownchoice的选定值,但我无法得到它.如何在dropdownchoice的更改事件中获取DropDownChoice的选定值?谢谢.一世
这很简单,你所要做的就是使用AjaxFormComponentUpdatingBehavior:
DropDownChoice<String> ddc = new DropDownChoice<String>("ddc", model, Arrays.asList("a", "b", "c"));
ddc.add(new AjaxFormComponentUpdatingBehavior("onchange") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
System.out.println("selected: " + model.getObject());
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2455 次 |
| 最近记录: |