Modify the scope of the data controller to save

1.1  Save the data to the session scoped way .

  1. Use the original HttpSession save.
  2. Use annotations @SessionAttributes (name = {key1, key2 })

 

 

 

    
    @RequestMapping("toDate.do")
    public String todate2(HttpSession session) {
        session.setAttribute("name","jk");
        return "login";
        
    }

Another is that nothing changed, write notes in class

 

 

 

 

@SessionAttributes(names= {"name"})

 

Guess you like

Origin www.cnblogs.com/sh-0131/p/11456154.html