Versions Compared

Key

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

...

Code Block
SelectOption[] options = new SelectOption[] {new SelectOption("&", "AND"), new SelectOption("|", "OR")};
ChoiceRenderer choiceRenderer = new ChoiceRenderer("value", "key");
add(new DropDownChoice("connective", model, Arrays.asList(options), choiceRenderer));

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.

...