SpringmvcTest.java
@RequestMapping("/springmvc") @Controller public class SpringmvcTest { private static final String SUCCESS = "success"; @RequestMapping(value="/testMap") public String testMap(Map<String,Object> map) { map.put("names", Arrays.asList("tom","jack","bob")); return SUCCESS; } }
Index.jsp
<a href="springmvc/testMap">testMap</a>
success.jsp
<p>Success</p> <p>names:${requestScope.names}</p>
启动服务器之后:
点击:
实际上传入的也可以是Model和ModelMap类型的参数。
原文地址:https://www.cnblogs.com/xiximayou/p/12178216.html
时间: 2024-10-30 05:22:05