jsp中java获取spring mvc返回的值

发布于 2016-07-20  52.98k 次阅读


	@RequestMapping(value = "/getParkInfo", params = "flag=1")
	public ModelAndView getParkInfo(@RequestParam int id, @RequestParam int flag, HttpServletRequest request, HttpServletResponse response) {
		ParkInfo parkInfo = parkinfoService.getParkInfo(id);
		mv.addObject("parkInfo", parkInfo);
		mv.setViewName("mgmt_m_parkinfo1");
		return mv;
	}

在jsp页面中可以直接用el表达式取,但在<%  xxxxxx   %>java中没办法获取

通过如下方法

<body>
........

<c:set var="kid" value="${ parkInfo.id }" scope="session"></c:set>
<%VisitorCounter.incCounter(Constant.F, session.getAttribute("kid").toString()); %>

...........
地址:${parkInfo.address }