当前位置:网站首页>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 collection
item.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
边栏推荐
- leetcode:126. 单词接龙 II
- Pytest first experience
- 助力数字政府建设,中科三方构建域名安全保障体系
- Thinking and Implementation of Object Cache Service
- Shell common script: Nexus batch upload local warehouse script
- 程序进程和线程(线程的并发与并行)以及线程的基本创建和使用
- 如何减少软件设计和实现之间鸿沟
- 新产品如何进行网络推广?
- /etc/sysconfig/network-scripts 配置网卡
- Payment module implementation
猜你喜欢
不知道该怎么办的同步问题
C程序设计-方法与实践(清华大学出版社)习题解析
一文概述:VPN的基本模型及业务类型
高等代数_证明_任何矩阵都相似于一个上三角矩阵
MLP神经网络,GRNN神经网络,SVM神经网络以及深度学习神经网络对比识别人体健康非健康数据
The article you worked so hard to write may not be your original
Audio alignment using cross-correlation
Pytest初体验
How to reduce the gap between software design and implementation
cobaltstrike
随机推荐
"SDOI2016" Journey Problem Solution
Binary tree non-recursive traversal
C程序设计-方法与实践(清华大学出版社)习题解析
Design of Fire and Anti-theft System Based on Single Chip GSM
10大主流3D建模技术
/usr/local/bin和/usr/bin的区别
如何减少软件设计和实现之间鸿沟
lua入门案例实战1234定义函数与标准函数库功能
面试突击69:TCP 可靠吗?为什么?
VOT2021比赛简介
面试题:实现死锁
如何导入 Golang 外部包并使用它?
Unity - by casting and cloning method dynamic control under various UGUI create and display
助力数字政府建设,中科三方构建域名安全保障体系
Federated Learning: Multi-source Knowledge Graph Embedding in Federated Scenarios
MLP神经网络,GRNN神经网络,SVM神经网络以及深度学习神经网络对比识别人体健康非健康数据
数据分析(一)——matplotlib
2022-07-31:给出一个有n个点,m条有向边的图, 你可以施展魔法,把有向边,变成无向边, 比如A到B的有向边,权重为7。施展魔法之后,A和B通过该边到达彼此的代价都是7。 求,允许施展一次魔法
Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads
Drawing process of hand-drawn map of scenic spots