UserSignInController と PageNavigationController の 2 つのコントローラーがあります。両方のコントローラーで同じ HttpSession を維持したいのですが、差分ページに差分セッションが見つかりました。コントローラー ページに @SessionAttributes("userDetails") も追加しました。これを作成する方法を教えてください。 ?
UserSignInController
@RequestMapping(value="/analyzeinternet1.html", method=RequestMethod.GET)
public ModelAndView getSocialMediaAdmin(HttpSession session, Model model) {
LOG.info(" session..." + session);
ModelAndView mv = null;
UserProfile up = (UserProfile) session.getAttribute("userDetails");
if(up == null) { //Checking whether the user is already signed up or not. If not, the user is redirected to login page.
LOG.info("No user in session...");
mv = new ModelAndView("redirect:/login.html");
} else {
LOG.info("User in session..." + up);
mv = new ModelAndView("internetanalyze");
model.addAttribute("userDetails", up);
session.setAttribute("userDetails", up);
mv.addObject("clientId", up.getUserId());
}
LOG.info(mv);
return mv;
}
PageNavigationController
@RequestMapping(value="/analyzeinternet.html", method=RequestMethod.GET)
public ModelAndView getAnalyzeInternet(HttpSession session, Model model) {
LOG.info("-----session..." + session);
//LOG.info("-----userprofile..." + userDetails);
ModelAndView mv = null;
up = (UserProfile) session.getAttribute("userDetails");
LOG.info("User in session..." + up);
mv = new ModelAndView("internetanalyze");
//mv.addObject("clientId", up.getUserId());
return mv;
}
両方のセッション ID が異なり、私のリダイレクト コードは
<a href="<%=request.getContextPath()%>/analyzeinternet.html">