How to use inline CSS by th:style using "The ? : operator" in ThymeLeaf

Viewed 10348

I am trying to put border color red if a student is fail by using following expression

<div class="image_wrap" th:style="${student.studentExamStatus}?border-style: solid;border-color: red;:">

but I am getting following exception Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "${student.studentExamStatus}?border-style: solid;border-color: red;:"

${student.studentExamStatus} will return either 0 or 1 based student passed exam or not.

1 Answers
Related