title: Populating and validating a bean
body: <p>I'd like to know that if it's possible to populate a bean and - assuming every property is type of String - validate that none of the properties are null or empty?</p>
  
  <p>As far as I researched, populating the bean is easy with <strong>BeanUtils</strong>, but I couldn't really find a solution for the validation part. Based on the user's previous selection, the populating could target a lot of bean types, but checking each property by hand destroys the advantage I gain. The only option that I see right now is using reflection but I'd like to avoid it if possible.</p>
  
  <p>Some pseudocode:</p>
  
  <pre><code>&lt;choose vehicle&gt;
  &lt;fill in form data&gt;
     &lt;if car&gt;
        &lt;auto populate carBean&gt;
        &lt;check every property by hand&gt;
     &lt;if boat&gt;
        &lt;auto populate boatBean&gt;
        &lt;check every property by hand&gt;
     ...
  </code></pre>
  
  <p>Any suggestions are appreciated!</p>
  
  <p>Edit 1: I forgot to mention that the form is on a JSP page, the data is processed by a servlet, and the beans are entities (POJOs).</p>