use CheckBoxMultipleChoice in wicket

 1         final CheckBoxMultipleChoice<String> resultlistChoice = new CheckBoxMultipleChoice<String>("resultlist", new PropertyModel<List<String>>(this, "valueList"), new PropertyModel<List<String>>(this, "list"));
 2 
 3         resultlistChoice.add(new AjaxFormComponentUpdatingBehavior("onclick") {
 4 
 5             @Override
 6             protected void onUpdate(AjaxRequestTarget target) {
 7                 // TODO Auto-generated method stub
 8             }
 9         });
10         
11         resultlistChoice.add(new AjaxFormChoiceComponentUpdatingBehavior() {
12             
13             @Override
14             protected void onUpdate(AjaxRequestTarget target) {
15                 // TODO Auto-generated method stub
16                 selectedList.clear();
17                 for (String item : resultlistChoice.getModelObject()) {
18                     selectedList.add(item);
19                     System.out.println(item);
20                 }
21                 target.add(selectedChoice);
22             }
23         });
posted @ 2012-06-18 00:08  MyFavorite  阅读(501)  评论(0编辑  收藏  举报