themleaf 三元表达式的简单运用

后端传值给mv对象

ModelAndView mv = new ModelAndView();
String isFont = Global.getIsFont();
mv.addObject("indexShow",isFont);

前端使用并接收

<td th:text="${indexShow}=='font'?'系统1':'系统2'"></td>
<div class="col-xs-4" style="padding-top: 6px;font-size:14px">
	<span th:if="${sysFileInfo.fileSecret} == 1">公开</span>
	<span th:if="${sysFileInfo.fileSecret} == 2">内部</span>
	<span th:if="${sysFileInfo.fileSecret} == 3">秘密</span>
	<span th:if="${sysFileInfo.fileSecret} == 4">机密</span>
	<span th:if="${sysFileInfo.fileSecret} == 5">绝密</span>
</div>
posted @ 2022-11-17 17:46  xiaolifc  阅读(78)  评论(0)    收藏  举报