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 项目中,我有一个 jsp 页面,注册页面,其中有一个表单。在这种形式中,用户插入他的数据(姓名,姓氏等)。我创建了一个 bean 用户,我用这个 bean 绑定了表单。但是现在我有一个问题。我怎样才能将用户对象放入会话中控制器的方法?我可以使用@SessionAttributes,httpsession 还是将 bean 的范围设置为 session?我该如何解决?对不起我的英语。谢谢
@SessionAttributes
您可以使用HttpSession,因此只需要在会话中设置您的用户对象并访问系统的任何位置。
HttpSession
请参阅此 httpsession 文档以设置会话值。