title: Validate partial Modal using Spring @Valid annotation
body: <p>I have a User Modal</p>
  
  <pre><code>public class RegisterUser {
  
      @Size(min = 2, max = 30)
      private String fname;
  
      @Size(min = 2, max = 30)
      private String lname;
  
      @NotEmpty
      @Size(min = 6, max = 15)
      private String password;
  
      ....
  
      @NotEmpty
      private String publicProfile;
  
       ... getters and setters
  
  }
  </code></pre>
  
  <p>1) I want to use this modal during registration action (fname, lname, password etc but without publicProfile field)</p>
  
  <p>2) I want to use this modal during myprofile action (all fields except password)</p>
  
  <p>My action for register:</p>
  
  <pre><code>@RequestMapping(value = "/register", method = RequestMethod.POST)
  public String submitRegisterForm(
          @Valid RegisterUser registerUser,
          BindingResult result,
          Model m) {
      ....
    }
  </code></pre>
  
  <p>Here I don't intend to provide 'publicprofile' on jsp and therefore do not want to validate this field although my Modal has @NotEmpty annotation </p>
  
  <p>My action for myprofile </p>
  
  <pre><code>@RequestMapping(value = "/myprofile", method = RequestMethod.POST)
  public String submitMyprofileForm(
      @Valid RegisterUser registerUser,
          BindingResult result,
          Model m) {
      ....
  }
  </code></pre>
  
  <p>Here I don't intend to provide 'password' field on jsp and therefore do not want to validate this field although my Modal has @NotEmpty and  @Size(min = 6, max = 15) annotation</p>
  
  <p>My question is how can I achieve this ? 
  Is there any way where I can say in this modal for this action validate only mentioned fields?</p>
  
  <p>Thanks in advance
  Manisha</p>