多案例的 Thymleaf 开关语句
2022-09-01 18:25:22
总之
我希望在百里香中具有逻辑的开关语句,一旦写入多个案例语句。
详细地
我想在百里香中实现这一点
switch(status.value){
case 'COMPLETE':
case 'INVALID':
//print exam is not active
break;
case 'NEW':
//print exam is new and active
break;
}
我当前的 thymleaf 代码因运行时错误而失败
<div th:switch="${status.value}">
<div th:case="'COMPLETE','INVALID'">
<!-- print object is not active -->
</div>
<div th:case="NEW'">
<!-- print object is new and active -->
</div>
</div>
但是上面的代码失败并出现错误
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "'COMPLETE','INVALID'"...
注意:我知道上述错误消息的原因。我所需要的只是知道一种方法来实现单个输出的多种情况的开关