当前位置:网站首页>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 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#
- SQL注入 Less54(限制次数的SQL注入+union注入)
- Pytest first experience
- 数据分析(一)——matplotlib
- SQL注入 Less47(报错注入) 和Less49(时间盲注)
- Flutter教程之 01配置环境并运行demo程序 (教程含源码)
- SQL injection Less46 (injection after order by + rand() Boolean blind injection)
- 信息学奥赛一本通 1941:【07NOIP普及组】Hanoi双塔问题 | 洛谷 P1096 [NOIP2007 普及组] Hanoi 双塔问题
- 二叉树非递归遍历
- UserAgent resolution
猜你喜欢

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

基于simulink的Passive anti-islanding-UVP/OVP and UFP/OFP被动反孤岛模型仿真

Google Earth Engine——Error: Image.clipToBoundsAndScale, argument ‘input‘: Invalid type的错误解决

How to reduce the gap between software design and implementation

【Acwing】The 62nd Weekly Game Solution

Unity-LineRenderer显示一条线

Flex layout in detail

ICML2022 | 深入研究置换敏感的图神经网络

【ACM】2022.7.31训练赛

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#
随机推荐
10大主流3D建模技术
【云驻共创】【HCSD大咖直播】亲授大厂面试秘诀
信奥学习规划 信息学竞赛之路(2022.07.31)
SQL注入 Less38(堆叠注入)
Unity - LineRenderer show a line
"APIO2010" Patrol Problem Solution
二叉树非递归遍历
thymeleaf迭代map集合
Collation of knowledge points in Ningbo University NBU IT project management final exam
lua入门案例实战1234定义函数与标准函数库功能
登录业务实现(单点登录+微信扫码+短信服务)
Weekly Summary
The article you worked so hard to write may not be your original
LeetCode 第 304 场周赛
新产品如何进行网络推广?
/etc/sysconfig/network-scripts 配置网卡
基于simulink的Active anti-islanding-AFD主动反孤岛模型仿真
助力数字政府建设,中科三方构建域名安全保障体系
Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)
一文概述:VPN的基本模型及业务类型