Witam,
chciałem się zapytać osób bardziej doświadczonych w Spring MVC o dostarczanie danych do formularza.
MIanowicie mam formularz który zawiera np 7 komponentow select (combobox) teraz aby dostarczyc do nich dane musze wykonac
@RequestMapping(method = RequestMethod.GET)
public String prepareForm( Model model) {
model.add("countryList1", service.getCountryList1());
model.add("countryList2", service.getCountryList2());
model.add("countryList3", service.getCountryList3());
model.add("countryList4", service.getCountryList4());
model.add("countryList5", service.getCountryList5());
model.add("countryList6", service.getCountryList6());
model.add("countryList7", service.getCountryList7());
return "account/createForm";
}
Oczywiscie jak mam inne formularze ktore zawieraja czesc tych komponentow znow musze powielac ten kod.
Czy nie można zrobić coś takiego jak w JSF 2
@Produces("countryList1")
public List provideCountryList1( Model model) {return service.getCountryList1()}