title: How do I set session or global attribute using Spring 3 MVC Annotations
body: <p>I have a simple application written in Java using Spring MVC. The Credentials class just contains the username &amp; password, supplied at login.</p>
  
  <p>Ideally I want the persons username and full name to be present on every jsp page. I am thinking of setting a session attribute.</p>
  
  <p>My Controller Class:</p>
  
  <pre><code>@RequestMapping(value = "/menu", method=RequestMethod.POST)
      public String addContact(Map&lt;String, Object&gt; map,@ModelAttribute("user")
      User user, BindingResult result, SessionStatus status,HttpSession session) {
  
  
  session.setAttribute("DisplyName", u.getDisplayName());
  </code></pre>
  
  <p>My JSP:</p>
  
  <pre><code> &lt;div class="wlctxt"&gt;Welcome &lt;%=session.getAttribute("DisplyName") %&gt;&lt;/div&gt;
  </code></pre>
  
  <p>But I get null value of session attribute here.</p>
  
  <p>Is there any other way to achieve this?</p>