您的位置:首页 > 编程语言 > Java开发

thymeleaf+spring boot 页面hashmap取值

2017-06-26 10:44 295 查看
1,controller 返回代码片段
List<CliUser> cliUsers = cliUserService.findByIds(userIds);
if (cliUsers != null) {
Map<Integer, String> userNames = new HashMap<>(cliUsers.size());
for (CliUser user : cliUsers) {
userNames.put(user.getId(), user.getName());
}
model.addAttribute("userNames", userNames);
}

2,thymeleatf 页面取值

<td><span th:text="${userNames[__${corp.creator}__]}"></span></td>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: