質問

I use wicket and I have created a List Choice like this and overriden onSelectionChanged:

   ListChoice<String> hotelList = new ListChoice<String>("hotel",
           new PropertyModel<String>(this, "selectedHotel"), hotelLabels)   {
      @Override
      protected void onSelectionChanged(String newSelection)
      {
         super.onSelectionChanged(newSelection);
         System.out.print("Tesy");
      }

   };

but it did not work - program never fires this method. I do not want use onSubmit to handle this. I need action when someone clicked smth on list.

How to do this in wicket?

役に立ちましたか?

解決

final ListChoice<String> hotelList = new ListChoice<String>("hotel", new PropertyModel<String>(this, "selectedHotel"), hotelLabels);
hotelList.add(new AjaxFormComponentUpdatingBehavior("onchange") {
  protected void onUpdate(AjaxRequestTarget target) {
    System.out.print(hotelList.getModel().getObject());
  }
});
hotelList.setOutputMarkupId(true); 
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top