i'm new to spring mvc Can anybody help me out of how to implement session in spring MVC ? and in specific can i know what is the actual use of @SessionAttribute annotation ?
1 Answer
Basically Spring’s @SessionAttributes is used on a controller to designate which model attributes should be stored in the session.
The for example defining like this in your controller
@Controller
@SessionAttributes("myRequestObject")
public class MyController {
...
}
And then the model Attribute will be added into HttpSession before render the view. Then in your view you can access through the session attributes.
<h3>Session Scope</h3>
<%
out.println(request.getSession().getAttribute(s));
%>
1 Comment
paul
Dont forget to marked as valid finish answer if you think that resolve your issue