public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) { Map<String, Object> data = .....; eturn true; } @RequestMapping(value = "/user/{uid}", method = RequestMethod.PUT) public JsonResult updateById(@PathVariable Integer uid) { 这里能否用到 data ? return userService.updateById(uid); }
如题, 在拦截器里产生的数据, 能否传给 handler
![]() | 1 DonaldY 2019-10-12 02:40:16 +08:00 可以, 通过 requestmap `this.setRequestAttribute(req, "", "");` `@RequestAttribute` |
2 wenzhoou 2019-10-12 08:26:13 +08:00 via Android 还可以用 thread local |