0

I have a list of guid in listOfShortlistedProfile as [cc0dfb4d-4b08-4f08-a8ce-10f12f860ed5, c6bc6a26-a9e0-4ca0-855a-2eeff3922998, a5b3b65b-76c5-446f-a083-4707ac3080d7] and I have a dynamic guid as ${searchResult.GUUID} as one value as c6bc6a26-a9e0-4ca0-855a-2eeff3922998 in thymeleaf and I want to check if this dynamic guid contains from list of guid. So, my code in Thymeleaf is like <span th:text="${#lists.contains(listOfShortlistedProfile,'${searchResult.GUUID}')}"></span> even I also tried with <span th:text="${#lists.contains(listOfShortlistedProfile,${searchResult.GUUID})}"></span> but all times it gives error as org.springframework.expression.spel.SpelParseException: Expression [#lists.contains(listOfShortlistedProfile,${searchResult.GUUID})] @42: EL1043E: Unexpected token. Expected 'rparen())' but was 'lcurly({)'

So, please confirm, how do I use contains in list in Thymeleaf with this runtime guid.

Ravi
  • 1
  • 4

1 Answers1

0

The curly brackets around the searchResult part are not needed because you are already in an expression. This is what the error signifies.

The correct code should look like this:

<span th:text="${#lists.contains(listOfShortlistedProfile,searchResult.GUUID)}"></span>
tbeni22
  • 108
  • 1
  • 4