【发布时间】:2015-02-06 13:24:59
【问题描述】:
是否可以在没有 RedirectAttributes 签名的方法中访问 RedirectAttributes?例如,当覆盖如下方法时:
@Override
public void onAuthenticationSuccess(final HttpServletRequest req, final HttpServletResponse res,
final Authentication auth) throws IOException, ServletException {
// add something to RedirectAttributes here
// redirectAttributes.addFlashAttribute("attr", "value");
super.onAuthenticationSuccess(req, res, auth);
}
我正在使用 spring 3.2.2.RELEASE。
【问题讨论】:
-
你打算用属性做什么?
-
@Ivan 我需要他们添加客户首次登陆主页的指示。
-
对不起,显然我不清楚这个问题:你打算使用什么 RedirectAttributes 方法?添加/获取FlashAttributes?我在问,因为有一种直接访问flash属性的方法,其他参数可以作为请求参数。
-
@Ivan 是的,我需要 redirectAttributes.addFlashAttribute
标签: java spring spring-mvc servlets