架构师之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

猜你喜欢

转载自nannan408.iteye.com/blog/2308839