SpringMVC---处理模型数据值Map

一:

二:代码实现

1.

private final String SUCCESS="success";
	
	/*
	 * 目标方法可以是Map类型(也可以是Model类型或者ModelMap类型)
	 */
	@RequestMapping("/testMap")
	public String testMap(Map<String, Object> map) {
		map.put("name", "dhx");
		return SUCCESS;
		
	}
	

 2.测试页面及结果页面

<a href="spring/testMap">test testMap</a>
	<br>
<h3>success</h3>
	times: ${requestScope.time }
	name:  ${requestScope.name}
发布了64 篇原创文章 · 获赞 12 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_39093474/article/details/103714187