title: Thymeleaf - check if a template exists
body: <p>I am searching a way to check if a template exists before returning it in a view with Thymeleaf and Spring.</p>
  
  <p>In my controller i was trying to do something like this:</p>
  
  <pre><code>String finalTemplate = template.getPrefix() + "/" + templateName;
  
          try {
              return finalTemplate;
          } catch(TemplateInputException e) {
              logger.debug("Sono qua");
              return templateName;
          }
  </code></pre>
  
  <p>but the exception is not catch...</p>