`
nannan408
  • 浏览: 1757411 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

架构师之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
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics