当前位置:网站首页>thymeleaf iterates the map collection
thymeleaf iterates the map collection
2022-07-31 23:22:00 【music code】
@WebServlet("/index")public class Ceshi extends ViewBaseServlet {static Map p1=new HashMap();static {p1.put("1",new Pring(1,"banana","20"));p1.put("2",new Pring(2, "apple","12"));p1.put("3",new Pring(3, "Watermelon","30"));}@Overrideprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {HttpSession session = req.getSession();session.setAttribute("p1", p1);super.processTemplate("index",req,resp);}} via
th:each="item:${session.p1}"traverse map collectionitem.value.id Get the value of the map collection variable id
item.getKey() Get the key of the current map
Use this to save data
HttpSession session = req.getSession();session.setAttribute("p1", p1);You can also do without static
边栏推荐
- VOT2021比赛简介
- C程序设计-方法与实践(清华大学出版社)习题解析
- 信息学奥赛一本通 1941:【07NOIP普及组】Hanoi双塔问题 | 洛谷 P1096 [NOIP2007 普及组] Hanoi 双塔问题
- The uniapp applet checks and prompts for updates
- hboot and recovery, boot.img, system.img
- Daily--Kali opens SSH (detailed tutorial)
- Flutter教程之 01配置环境并运行demo程序 (教程含源码)
- "SDOI2016" Journey Problem Solution
- Thinking and Implementation of Object Cache Service
- 登录业务实现(单点登录+微信扫码+短信服务)
猜你喜欢
I don't know what to do with sync issues
Dry goods | 10 tips for MySQL add, delete, change query performance optimization

UOS - WindTerm use

网易云信圈组上线实时互动频道,「破冰」弱关系社交

【Acwing】第62场周赛 题解

Shell common scripts: Nexus batch upload local warehouse enhanced version script (strongly recommended)
不知道该怎么办的同步问题

浏览器下载快捷方式到桌面(PWA)

In Golang go-redis cluster mode, new connections are constantly created, and the problem of decreased efficiency is solved

登录业务实现(单点登录+微信扫码+短信服务)
随机推荐
SQL injection Less47 (error injection) and Less49 (time blind injection)
Design of Fire and Anti-theft System Based on Single Chip GSM
C# Rectangle基本用法和图片切割
C程序设计-方法与实践(清华大学出版社)习题解析
硬件设备计算存储及数据交互杂谈
【Acwing】第62场周赛 题解
10大主流3D建模技术
Flutter教程之 01配置环境并运行demo程序 (教程含源码)
Dry goods | 10 tips for MySQL add, delete, change query performance optimization
Payment module implementation
消息队列消息存储设计(架构实战营 模块八作业)
Flutter教程之四年开发经验的高手给的建议
Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)
一款国外开发的高质量WordPress下载站模板主题
I don't know what to do with sync issues
Unity - by casting and cloning method dynamic control under various UGUI create and display
SQL27 View user details of different age groups
ICML2022 | 深入研究置换敏感的图神经网络
面试突击69:TCP 可靠吗?为什么?
[QNX Hypervisor 2.2 User Manual]9.14 set