Announcement Announcement Module
No announcement yet.
How to store session data in spring 3 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to store session data in spring 3

    I am using spring 3 mvc, annotation based.

    I am storing session data using @sessionattribute and @Modelattribute annotations at class level and method level respectively.

    It works fine. BUT the problem is

    The http request attribute values with the same name as session object attributes, are being overridden in session object.

    How to avoid this ? Now i have to switch to traditional session.getAttribute way of managing session data which is not impressive in spring world.

    Eg: I have User(logged in) Object in session with properties firstName, lastName... I have (referal)html form with input names as firstName and LastName(which are not same as logged in user). When ever I pull session user object in handler method, data coming from http request is over writing Session user Object values.

    What is the best practice to store and retrieve session data in controllers and views?

    Any help?