当前位置:网站首页>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
边栏推荐
- Federated Learning: Multi-source Knowledge Graph Embedding in Federated Scenarios
- SQL注入 Less54(限制次数的SQL注入+union注入)
- 基于simulink的Passive anti-islanding-UVP/OVP and UFP/OFP被动反孤岛模型仿真
- 博弈论(Depu)与孙子兵法(42/100)
- 嵌入式开发没有激情了,正常吗?
- SQL injection Less46 (injection after order by + rand() Boolean blind injection)
- Unity-通过预制件和克隆方法动态实现各个UGUI下控件的创建和显示
- 标段参数说明
- UOS - WindTerm use
- Difference Between Stateless and Stateful
猜你喜欢

Summary of the classic drawing method of histogram

TestCafeSummary

面试突击69:TCP 可靠吗?为什么?

Audio alignment using cross-correlation

Pytest初体验

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#

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

什么是客户画像管理?

【云驻共创】【HCSD大咖直播】亲授大厂面试秘诀

Recognize anomalies (you will understand after reading this)
随机推荐
Payment module implementation
How to import a Golang external package and use it?
一文概述:VPN的基本模型及业务类型
"SDOI2016" Journey Problem Solution
[QNX Hypervisor 2.2 User Manual]9.14 set
SQL注入 Less42(POST型堆叠注入)
日常--Kali开启SSH(详细教程)
Flutter教程之 01配置环境并运行demo程序 (教程含源码)
Handwritten a simple web server (B/S architecture)
「APIO2010」巡逻 题解
【FPGA教程案例43】图像案例3——通过verilog实现图像sobel边缘提取,通过MATLAB进行辅助验证
lua入门案例实战1234定义函数与标准函数库功能
「SDOI2016」征途 题解
TestCafeSummary
The difference between /usr/local/bin and /usr/bin
VOT2021 game introduction
Difference Between Stateless and Stateful
Bionic caterpillar robot source code
消息队列消息存储设计(架构实战营 模块八作业)
Network security - crack WiFi through handshake packets (detailed tutorial)