I come from languages like PHP or ColdFusion: if I wanted to save something in user’s http session I act like this:
SESSION["foo"] = "bar"
Now I am in a Spring MVC environment.
For example, inside a Controller method, how can I save a variable in session?
Someone told me that a session-scoped bean would get the job.
Can you help me with a trivial code snippet?
You may use a session-scoped bean, and you may also have an argument of type HttpServletRequest or HttpSession on all your request handling methods. See http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/htmlsingle/spring-framework-reference.html#mvc-ann-methods.