架构师之freemark之json的list处理
1.前言。
如题。
2.代码。
(1)java
@RequestMapping(method = RequestMethod.GET) public ModelAndView index() { ModelAndView view = new ModelAndView("sc"); List<TestVO> list = new ArrayList<TestVO>(); TestVO contentVO = new TestVO(); contentVO.setTitle("title1"); list.add(contentVO); JSONObject json = new JSONObject(); json.accumulate("list", list); view.addObject("message", json); return view; }
(2)页面
<#list message.list as content> title是:${content.title} </#list>
(3)最终结果:
title是:title1
相关推荐
yanghuashuiyue 2020-11-14
ruancw 2020-08-27
frank0 2020-08-26
wl00 2020-08-26
TuxedoLinux 2020-08-18
程序员生态圈 2020-08-04
lovecodeblog 2020-07-28
Cricket 2020-06-14
Noseparte 2020-06-13
架构技术交流 2020-06-11
舍我其谁 2020-06-09
yuanxiaogang 2020-06-06
范群松 2020-06-06
quguang 2020-06-06
85231843 2020-05-31
ChenRuiyz 2020-05-15
Jaiky杰哥 2020-05-15
DAV数据库 2020-05-07