title: How to add Object in using model.addAttributes in Spring MVC
body: <p>I'm trying to retrieve the user information from DB and display in the front end (JSP) using Spring MVC.</p>
  
  <p>Inside the controller, currently I'm adding  the following code,</p>
  
  <pre><code>                     ModelMap model;
          model.addAttribute("email", user.getEmailAddress());
          model.addAttribute("name", user.getuserName());
          model.addAttribute("birthday", user.getBirthday());
      model.addAttribute("street",user.getUserAddress().getStreet_address());
          model.addAttribute("state", user.getUserAddress().getState());
          model.addAttribute("city", user.getUserAddress().getCity());
          model.addAttribute("zip", user.getUserAddress().getZip());
          model.addAttribute("country", user.getUserAddress().getCountry());
  </code></pre>
  
  <p>In the front-end JSP, I display them using ${email} ,${name} ,${birthday} etc . However I would like to do something like this,</p>
  
  <p>ModelMap model;
  model.addAttribute("user",user);</p>
  
  <p>and in front end , display as ${user.getName()}. However this is not working . Can you let me know if there are any other ways to do this ?</p>