title: How can I exclude/ disallow field in Validator in Spring
body: <p>I have 2 forms</p>
  
  <ol>
  <li>Add Book (addBook.jsp) and It's controller (AddBookController.java)</li>
  <li>Edit Book(editBook.jsp) and It's controller (EditBookController.java)</li>
  </ol>
  
  <p><code>Book.java</code> is bean class for both views.</p>
  
  <p>I have same UI for <code>editBook.jsp</code> and <code>addBook.jsp</code>.</p>
  
  <p>I have created <code>org.springframework.validation.Validator</code> (<code>BookValidator.java</code>) for add book same Validator can be use for EditBookController.java</p>
  
  <p>But in <code>AddBookController</code> when user is entering Book information user must enter unique bundle number. I have some validations for Unique bundle number on <code>BookValidator</code>.</p>
  
  <p>This validations must not work while user EditBook.</p>
  
  <p>I want to exclude / disallow field for validations while book edit.</p>
  
  <p>I have done </p>
  
  <pre><code>binder.setDisallowedFields(new String[] {"bundleNumber"});
  </code></pre>
  
  <p>but not helped me.</p>
  
  <p>Please suggest me How i can re use validator ?</p>