title: Spring 2.5 Form validation - Dynamic data lost if validator is called?
body: <p>I have a simple form that has a select box populated by the database. When validation is triggered the select box is empty. I'm new to spring and I seem to be missing something.</p>
  
  <p>Any help is appreciated? Thanks in advance.</p>
  
  <p>In the controller below sites is the dynamic content.</p>
  
  <pre><code>@RequestMapping("/registration/registration.html")
  public ModelMap setupRegistrationForm(HttpServletRequest request, RegistrationForm form) {
      ModelMap map = new ModelMap();
      I18NSite[] sites = new Sites().getSites();
      map.put("sites", sites);
      return map;
  }
  
  @RequestMapping(value="/registration/registration.html", method = RequestMethod.POST)
  public String saveRegistrationForm(HttpServletRequest request,RegistrationForm form, BindingResult errors) {
      I18NSite site = Sites.getSite(); 
      RegistrationFormValidator validator = new RegistrationFormValidator();
      validator.setDataSource(site.getDataSource());
      validator.validate(form,errors);
  
      if (errors.hasErrors()) {
          return "registration/registration";
      } else {
          // other code
      }
  
      return "redirect:/index.html";
  }
  </code></pre>