title: HttpSessionRequiredException: Session attribute 'registrationForm' required - not found in session
body: <p>I get this error only on certain situations. What I'm coding is a registration form, here is the basic code:</p>
  
  <pre><code>@Controller
  @SessionAttributes("registrationForm")
  @RequestMapping(value = "/registration")
  public class RegistrationController
  {
      @Autowired
      private RegistrationValidator registrationValidator;
  
      @RequestMapping(method = RequestMethod.GET)
      public String setupForm(Model model) throws Exception
      {
          return setupForm(model, new RegistrationForm());
      }
  
      @RequestMapping(method = RequestMethod.POST)
      public String submitForm(@ModelAttribute("registrationForm") RegistrationForm registrationForm,
                               Model model,
                               BindingResult result,
                               SessionStatus sessionStatus) throws Exception
      {
          registrationValidator.validate(registrationForm, result);
  
          if(result.hasErrors())
          {
              return setupForm(model, registrationForm);
          }
          else
          {
              // Do stuff
  
              sessionStatus.setComplete();
  
              return "redirect:success";
          }
      }
  
      private String setupForm(Model model, RegistrationForm registrationForm) throws Exception
      {
          model.addAttribute("currentYear", Calendar.getInstance().get(Calendar.YEAR));
          model.addAttribute("registrationForm", registrationForm);
          return "registration";
      }
  </code></pre>
  
  <p>The form:</p>
  
  <pre><code>&lt;form:form method="POST" modelAttribute="registrationForm"&gt;
      ...
  &lt;/form:form&gt;
  </code></pre>
  
  <p>The very strange problem I have, is that if I clear the session data and I go straight to <code>/registration</code>, the whole registration process works perfectly. But when I call a page that is mapped in another controller first (i.e. home page), then I get the error specified in the title.</p>
  
  <p>Can anyone help me?</p>
  
  <p>Thank you.</p>