title: Thymeleaf: th:text only if not null?
body: <p>I have something like below, which of course works if user had previously input his wrong credentials.</p>
  
  <p>However if I directly go to my login fail url <code>/login?error</code> for example without any previous incorrect logins, <code>session[SPRING_SECURITY_LAST_EXCEPTION]</code> is of course <code>null</code> and I get a nasty <strong>404</strong>.</p>
  
  <pre><code>&lt;span th:text="${session[SPRING_SECURITY_LAST_EXCEPTION].message}"&gt;Invalid credentials&lt;/span&gt;
  </code></pre>
  
  <p><strong>Question</strong>: </p>
  
  <p>Is there a processor for something like below (which is too long to write and read most of the time), or should I just roll my own?</p>
  
  <pre><code>&lt;span th:text="${session[SPRING_SECURITY_LAST_EXCEPTION] != null ? session[SPRING_SECURITY_LAST_EXCEPTION].message : #messages.msg('AbstractUserDetailsAuthenticationProvider.badCredentials')}"&gt;
      Invalid credentials
  &lt;/span&gt;
  </code></pre>