Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There is no "default" value. the The value selected in the dropdown will be the one that is set in the model that the drop down uses. so So when you submit, the selected object is pushed into the model, when dropdown renders the selected object is the one that is pulled from the model.

...

The ChoiceRenderer will use the value of the 'key' property of SelectOption object in the 'value' attribute in the rendered HTML (e. g. 'key' property value will be used as the option id). The 'value' property will be used as a display value for the given option.   Your backing model must use SelectOption as compared to String in the simple example. 

Note

See also the JavaDoc for the ChoiceRenderer. Another example of custom ChoiceRenderer can be found in the DropDownChoice component reference in the Wicket Library.

...

If AJAX is used instead, the dropdown doesn't itself get reloaded, so the nullSelection string remains (and can still be selected.)

Another DropDownChoice Example by Adam