title: Spring 3.0 set and get session attribute
body: <p>I want to read a domain object (UserVO) from session scope.</p>
  
  <p>I am setting the UserVO in a controller called WelcomeController</p>
  
  <pre><code>@Controller
  @RequestMapping("/welcome.htm")
  public class WelcomeController {
  @RequestMapping(method = RequestMethod.POST)
      public String processSubmit(BindingResult result, SessionStatus status,HttpSession session){
        User user = loginService.loginUser(loginCredentials);
       session.setAttribute("user", user);
           return "loginSuccess";
      }
  }
  </code></pre>
  
  <p>I am able to use the object in jsp pages <code>&lt;h1&gt;${user.userDetails.firstName}&lt;/h1&gt;</code></p>
  
  <p>But I am not able to read the value from another Controller,</p>
  
  <p>I am trying to read the session attribute as follows:</p>
  
  <pre><code>@Controller
  public class InspectionTypeController {
  @RequestMapping(value="/addInspectionType.htm", method = RequestMethod.POST )
   public String addInspectionType(InspectionType inspectionType, HttpSession session)
   {
             User user = (User) session.getAttribute("user");
             System.out.println("User: "+ user.getUserDetails().getFirstName);
  
          }
  } 
  </code></pre>