title: Thymeleaf empty value check
body: <p>I am using Thymeleaf template to send email. I have a template like:</p>
  
  <pre><code>My name is ${name}
  </code></pre>
  
  <p>If <code>name</code> is empty or <code>null</code>, I don't want to send the email. Is there any Thymeleaf property that I can set which will generate an error and won't send the mail? Because sending "My name is " in an email without the value won't make any sense.</p>
  
  <p>I am getting all the values from the Thymeleaf context and the variables could be of a different type like <code>List</code>, <code>Map</code>, etc.  I have tried the following too, but it doesn't solve my problem since an object is always available:</p>
  
  <pre><code>HashMap&lt;String,Object&gt; allVar = ctx.getVariables();
  boolean isVAlid;
  
  for(HashMap.Entry&lt;String, Object&gt; entry : allVar.entrySet()){
      logger.info("[ESUB2.0] key and Value" + entry.getKey() + "Value" + entry.getValue());
      if(entry.getValue()==null){
         logger.info("[ESUB2.0] Null check ")
         isVAlid = true
      }
  }
  </code></pre>