Reference data is lost when form fails validation in spring3 annotation based controller?

You should provide reference data like your CountryDivisions with the help of the annotation @ModelAttribute. This has the great advantage that you don't need to repeat yourself over and over and provide the same data within multiple methods.

You should provide reference data like your CountryDivisions with the help of the annotation @ModelAttribute. This has the great advantage that you don't need to repeat yourself over and over and provide the same data within multiple methods. For your example I would provide something like this: @ModelAttribute("countryDivisions") public List populateCountryDivisions() { return countryDivisionService.

GetCountryDivisionOrderedByCode(); } This gives your views access to a model attribute called "countryDivisions" that holds a list of "CountryDivison"-objects provided by the service method from your "countryDivisionService".

Thanks! That makes sense. For some reason, it didn't occur to me to have more than one method annotated at @ModelAttribute – nont Sep 17 '10 at 11:22 You are welcome!

It is completely valid to have multiple methods annotated with @ModelAttribute in one single controller. – stefanglase Sep 17 '10 at 15:28.

Why not just do if (result.hasErrors()) { model. Put("commandName", "myInfoForm"); loadReferenceData(model); return "contactEdit"; }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions