当前位置:网站首页>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
边栏推荐
- PHP三元(三目)运算符
- SQL injection Less54 (limited number of SQL injection + union injection)
- 网易云信圈组上线实时互动频道,「破冰」弱关系社交
- ICML2022 | 深入研究置换敏感的图神经网络
- SQL27 View user details of different age groups
- 《ArchSummit:时代的呐喊,技术人听得到》
- Shell常用脚本:Nexus批量上传本地仓库脚本
- (26)Blender源码分析之顶层菜单的关于菜单
- SQL注入 Less54(限制次数的SQL注入+union注入)
- 博弈论(Depu)与孙子兵法(42/100)
猜你喜欢

Interview assault 69: TCP reliable?Why is that?

Pytest初体验

网络安全--通过握手包破解WiFi(详细教程)

cobaltstrike

Drawing process of hand-drawn map of scenic spots

The latest masterpiece!Alibaba just released the interview reference guide (Taishan version), I just brushed it for 29 days

leetcode:126. 单词接龙 II

日常--Kali开启SSH(详细教程)

C#中引用类型的变量做为参数在方法调用时加不加 ref 关键字的不同之处

Unity-LineRenderer显示一条线
随机推荐
Shell common script: Nexus batch upload local warehouse script
Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)
The difference between /usr/local/bin and /usr/bin
Network security - crack WiFi through handshake packets (detailed tutorial)
面试突击69:TCP 可靠吗?为什么?
C# Rectangle基本用法和图片切割
标段参数说明
mysql having的用法
VOT2021 game introduction
UserAgent resolution
Summary of the classic drawing method of histogram
消息队列消息存储设计(架构实战营 模块八作业)
Learn about C# anonymous methods
逐步手撕轮播图3(保姆级教程)
10大主流3D建模技术
leetcode:126. 单词接龙 II
IJCAI2022 | 代数和逻辑约束的混合概率推理
SQL injection Less47 (error injection) and Less49 (time blind injection)
(26)Blender源码分析之顶层菜单的关于菜单
不知道该怎么办的同步问题