当前位置:网站首页>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
边栏推荐
- 程序进程和线程(线程的并发与并行)以及线程的基本创建和使用
- The uniapp applet checks and prompts for updates
- VOT2021比赛简介
- SQL注入 Less46(order by后的注入+rand()布尔盲注)
- cobaltstrike
- 如何撰写出一篇优质的数码类好物推荐文
- Dry goods | 10 tips for MySQL add, delete, change query performance optimization
- SQL注入 Less54(限制次数的SQL注入+union注入)
- 网易云信圈组上线实时互动频道,「破冰」弱关系社交
- SQL27 View user details of different age groups
猜你喜欢

/etc/sysconfig/network-scripts 配置网卡

什么是客户画像管理?

Interview assault 69: TCP reliable?Why is that?

Handwritten a simple web server (B/S architecture)

Summary of the classic drawing method of histogram

Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads

VOT2021 game introduction

什么是动态规划,什么是背包问题

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

如何减少软件设计和实现之间鸿沟
随机推荐
TypeScript 的组件
thymeleaf迭代map集合
Difference Between Stateless and Stateful
【Acwing】The 62nd Weekly Game Solution
嵌入式开发没有激情了,正常吗?
如何导入 Golang 外部包并使用它?
Fixed-length usage of nanopb string type based on RT1052 Aworks (27)
Federated Learning: Multi-source Knowledge Graph Embedding in Federated Scenarios
Document management and tools in the development process
@JsonFormat(pattern="yyyy-MM-dd") time difference problem
Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)
The difference between adding or not adding the ref keyword when a variable of reference type is used as a parameter in a method call in C#
基于RT1052 Aworks nanopb string 类型固定长度使用方式(二十七)
硬件设备计算存储及数据交互杂谈
The article you worked so hard to write may not be your original
22年8月推广大使额外奖励规则
SQL注入 Less46(order by后的注入+rand()布尔盲注)
Shell common scripts: Nexus batch upload local warehouse enhanced version script (strongly recommended)
一文概述:VPN的基本模型及业务类型
SQL injection Less42 (POST type stack injection)