How can I check if the user have correctly submitted the previous form into a Spring MVC application that contemplate some steps?
<p>I am pretty new in Spring MVC and I have the following situation.</p>

<p>I am working on a Spring MVC application that implement a user registration process. The prcess is divided into 4 steps. In each step the user insert some information into a form that is submitted and that is handled by the related method into the controller class. Each of these controller method take the related command object that contains the information of the submitted form.</p>

<p>So I have something like this:</p>

<pre><code>@Controller
public class RegistrazioneController {

    // This is the first step and show a view that contain the first form:
    @RequestMapping(value = "/registrationStep1")
    public String registrationStep1(Model model) {
        return "/registrazione/registration-step1";
    }

    @RequestMapping(value = "/registrationStep2", method = RequestMethod.POST)
    public String registrationStep2(@ModelAttribute RegistrationStep1 registrationStep1, Model model) throws APIException {
        .......................................................
        .......................................................
        .......................................................
        return "/registrazione/registration-step2";
     }

    @RequestMapping(value = "/registrationStep3", method = RequestMethod.POST)
    public String registrationStep3(@ModelAttribute RegistrationStep3 registrationStep3, Model model) throws APIException {
        .......................................................
        .......................................................
        .......................................................
        return "/registrazione/registration-step3";
     }

     // This method return the final view after the completation of the user registration:
     @RequestMapping(value = "/registrationStep4", method = RequestMethod.POST)
    public String registrationStep2(@ModelAttribute RegistrationStep4 registrationStep4, Model model) throws APIException {
        .......................................................
        PERFORM THE USER REGISTRATION
        .......................................................
        return "/registrazione/registration-step4";
     }

}
</code></pre>

<p>So it works pretty fine. My problem is that the application have tho check that, when enter into a registration step, the previous steps are completed (the previous form was compiled and submitted).</p>

<p>So I think that I have to do something like this, for example: ** when enter into the <strong>registrationStep3()</strong> have to check if the command object of the previous <strong>registrationStep2()</strong> step method was correctly setted (it is valid), so it means that the user have completed the previous registration step.</p>

<p>The application have to prevent that the user try to acces the registration starting from a step without having complete the previous steps of the registration process.</p>

<p>What is the best way to implement this behavior?</p>