Thymeleaf - Spring boot - Empty validation

Asked

Viewed 594 times

0

I have this code that already works:

<span class="label" th:classappend="${usuario.ativo ? 'label-success' : 'label-danger'}"> </span></td>

but now I want the following:

    <span class="label" th:classappend="${usuario == vazio ? 'label-success' : 'label-danger'}"> </span></td>

if the user is equal to empty the label will be label-Danger

but it didn’t work because I was wrong ... someone could help me?

  • ${#strings.isEmpty(name)} found the answer link: https://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#strings

2 answers

2


0

Try the modification below. If that’s it, ok. Otherwise you need to add more information to the question, friend.

 <span class="label" th:classappend="${usuario == null ? 'label-success' : 'label-danger'}"> </span></td>
  • 1

    Thanks for the help. I solved with: ${#strings.isEmpty(name)}

  • @Joycesd, since you’ve solved it, provide an answer to your own question :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.