Css 尝试更改背景颜色时,Thymeleaf无法解析为表达式

Css 尝试更改背景颜色时,Thymeleaf无法解析为表达式,css,spring,spring-boot,spring-mvc,thymeleaf,Css,Spring,Spring Boot,Spring Mvc,Thymeleaf,我试图根据从数据库中获取的对象的变量systemStatus更改div的背景 th:style="${system.systemStatus} == 1} ? 'background: green' : 'background: red'" 但我得到了一个错误: org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "${system.systemS

我试图根据从数据库中获取的对象的变量
systemStatus
更改div的背景

th:style="${system.systemStatus} == 1} ? 'background: green' : 'background: red'"
但我得到了一个错误:

org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "${system.systemStatus} == 1} ? 'background: green' : 'background: red'" (template: "system-management" - line 48, col 41)
我尝试创建一个函数,以获取
systemStatus
作为字符串:

th:style="${system.systemStatusString()} == '1'} ? 'background: green' : 'background: red'"
但我也犯了同样的错误

整个部门:

<div class="form-group" th:style="${system.systemStatus} == 1} ? 'background: green' : 'background: red'">
    <label for="id">ID: </label>
    <input type="text" th:value="${system.id}" th:name="id" th:id="id"  class="form-control" id="id" readonly />
    <br>
    <label for="machineId">Machine ID: </label>
    <input type="text" th:value="${system.machineId}" th:name="machineId" th:id="machineId"  class="form-control" id="machineId"/>
</div>

身份证件:

机器ID:
您有一个额外的
}
。实际代码应该是


th:style=“${system.systemStatus}==1?'background:green':'background:red'

在示例中,您有一个开始的
{
,但有两个结束的
}
s。