Java 序列化

wylc123 1年前 ⋅ 1802 阅读

 

<!--Json array end -->
<dependency>
			<groupId>commons-beanutils</groupId>
			<artifactId>commons-beanutils</artifactId>
			<version>1.7.0</version>
		</dependency>
		<dependency>
			<groupId>commons-collections</groupId>
			<artifactId>commons-collections</artifactId>
			<version>3.1</version>
		</dependency>
		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.5</version>
		</dependency>
		<dependency>
			<groupId>net.sf.ezmorph</groupId>
			<artifactId>ezmorph</artifactId>
			<version>1.0.3</version>
		</dependency>
		<dependency>
			<groupId>net.sf.json-lib</groupId>
			<artifactId>json-lib</artifactId>
			<version>2.4</version>
			<classifier>jdk15</classifier>
		</dependency>
		<!--Json array end -->

关于使用JSONArray.fromObject()方法和引入net.sf.json包所需要的jar包支持

/**
	 * 跳转到全市总体概览
	 * @return
	 */
	@GetMapping("all")
	public String all (Model model) {
		Calendar cal = Calendar.getInstance();
		//当前年的前一年
		int year = cal.get(Calendar.YEAR) - 1;
		model.addAttribute("maxYear",year);
		model.addAttribute("minYear",minYear);
		model.addAttribute("title","全市"+year+"年主要经济指标运行情况");
		model.addAttribute("thisObj","all_id");
		List<Economicdatayear> list = eyService.GethistoricalTrendallTimeLine("合肥");
		JSONArray yearlist = JSONArray.fromObject(list);
		model.addAttribute("yearlist",yearlist);
		return "page/report6";
	}

Spring Boot用Model传list值到页面,需要先转换一下

前端js接收直接用var yearlist=[[${yearlist}]];

更多内容请访问:IT源点

相关文章推荐

全部评论: 0

    我有话说: