Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Spring MVC中的“ModelAndView.addObject”和“Session.setAttribute”有什么区别?
似乎他们都可以共享 Object 并在 JSP 中使用。
有很多不同之处,但是您是从 JSP 页面的角度来询问的。
在这方面,ModelAndView.addObject 将使变量可用于 JSP 的请求范围,而 Session.setAttribute 将使变量可用于 JSP 的会话范围。