title: Spring MVC set attribute to request/model/modelMap
body: <p>I use Spring MVC. I need to add attribute to request or other object. It should be message that will display on screen. For example, if I use pure Servlets I may just:</p>
  
  <pre><code>request.setAttribute("message", "User deleted");
  </code></pre>
  
  <p>and than on JSP page</p>
  
  <pre><code>&lt;div id="message"&gt;${message}&lt;/div&gt;
  </code></pre>
  
  <p>but  when I try to do something like this in method:</p>
  
  <pre><code>@RequestMapping(value = "/delete", method = RequestMethod.GET)
  public String deleteUser(@RequestParam("login") String login,
          ModelMap map, HttpServletRequest request)
  </code></pre>
  
  <p>Model object -  </p>
  
  <pre><code>model.addAttribute("message", "User deleted");
  </code></pre>
  
  <p>Map - </p>
  
  <pre><code>map.put("message", "User deleted");
  </code></pre>
  
  <p>ModelMap - </p>
  
  <pre><code>map.put("message", "User deleted");
  </code></pre>
  
  <p>HttpServletRequest - </p>
  
  <pre><code>request.setAttribute("message", "User deleted");
  </code></pre>
  
  <p>nothing displays. But in my browser I see: http:// localhost : 8081 /project/index?message=User+deleted</p>
  
  <p>How to solve this little problem?
  Thanks for your answers</p>
  
  <p>Updated:</p>
  
  <p>for clear understanding I try to do this:</p>
  
  <pre><code> @RequestMapping(value = "/delete", method = RequestMethod.GET)
  public String deleteUser(@RequestParam("login") String login,
          Model model) {
      dao.delete(login); // there is NO exeptions
      map.addAttribute("message", "User " + login + " deleted");
      return "redirect:" + "index";
  }
  </code></pre>
  
  <p>in my JSP I also display user login this way:</p>
  
  <pre><code>${user.login}
  </code></pre>
  
  <p>it takes user from Session and I see it login</p>