Actually i am setting the attributes which are getting from bean class in modelandveiw method and trying to get that attribute in other modelandveiw method method but getting null values in
rs.getAttribute("customerId")
. Please help me.
@RequestMapping(value ="/insert",method= RequestMethod.Post) public ModelAndView inserData(@ModelAttribute SavingBean savingBean,HttpServletRequest rs) { HttpSession session = rs.getSession(); if (savingBean != null) SavingBean saving = persionalService.insertData(savingBean); int a = saving.getCustomerId(); rs.setAttribute("customerId",a ); System.out.println(saving.getDisgnProf()); List<SavingBean> list = new ArrayList<SavingBean>(); list.add(saving); return new ModelAndView("welcome","list", list); } @RequestMapping(value ="/insertdata",method= RequestMethod.Post) public ModelAndView check (@ModelAttribute SavingBean savingBean,HttpServletRequest rs) { System.out.println(savingBean.getFirstName()); HttpSession session = rs.getSession(); System.out.println("abhishek" + rs.getAttribute("customerId")); return null ; }