spring MVC 前后台 映射关系

很多时候我都容易被spring MVC,前后台映射关系弄晕。 今天总结下以便以后回顾方便,本人菜鸟一枚,如有不对欢迎指点!


srping MVC 都是大家所熟悉的框架  我们先来个Controller的写法

@RequestMapping(value = "/addCount", method = RequestMethod.GET)

value:相当于给这个Controller的alreadyAudit()方法定义了一个访问路径,/addCount。

	@RequestMapping(value = "/addCount", method = RequestMethod.GET)
	public ModelAndView alreadyAudit(SeachForm seachForm,HttpServletRequest request, HttpServletResponse response) throws Exception {
		Map<String ,Object> paramMap = new HashMap<String ,Object>();
		List<AddCountBackVo> addCountBackVos = null;
		
		addCountBackVos = addCountService.queryAddCount(seachForm);
				
		paramMap.put("addCountBackVos", addCountBackVos);
		
		return new ModelAndView("/statistics/statisticsCount", paramMap);
	}

jsp页面上有的访问方法的地址如下:

     <li><a href="/ad_ops/addCount">总表统计</a></li>
上面的Controller方法中有个返回值ModelAndView("/statistics/statisticsCount", paramMap)返回值,/statistics/statisticsCount  就是对应的jsp文件。

spring MVC 前后台 映射关系_第1张图片


你可能感兴趣的:(spring MVC 前后台 映射关系)