title: Spring 3 -- accessing Model values in JSP
body: <p>I have a JSP where I am trying to print out values from my Model, but nothing appears in the place where I refer to those values.  Here is the controller method where I set the values.</p>
  
  <pre><code>@RequestMapping(value = "/poll1", method = RequestMethod.POST)
  public String processPoll1(@RequestParam String vote,
          HttpServletResponse response, Model model) {
      Map&lt;String, Object&gt; resultMap = poll1DAO.tallyVote(vote);
      Cookie poll1 = new Cookie("poll1", "voted");
      model.addAttribute("poll1Yes", resultMap.get("yes").toString());
      model.addAttribute("poll1No", resultMap.get("no").toString());
      poll1.setMaxAge(maxSeconds);
      response.addCookie(poll1);
      return "redirect:/polls";
  }
  </code></pre>
  
  <p>Here is the part of the JSP where I refer to the Model attributes.</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;b&gt;&lt;i&gt;Poll #1 -- &lt;/i&gt;&lt;/b&gt;Would you like to have a 30-year reunion in 2016?&lt;br&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;b&gt;Yes&lt;/b&gt;&lt;/td&gt;
          &lt;td&gt;&amp;nbsp;&amp;ndash;&amp;nbsp;&lt;c:out value='${model.poll1Yes}' /&gt;&lt;br /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;b&gt;No&lt;/b&gt;&lt;/td&gt;
          &lt;td&gt;&amp;nbsp;&amp;ndash;&amp;nbsp;&lt;c:out value='${model.poll1No}' /&gt;&lt;br /&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Here is my output.  Instead of actual values, nothing is printed out in the attributes' places.</p>
  
  <pre><code>Poll #1 -- Would you like to have a 30-year reunion in 2016?
  
  Yes  – 
  
  No  –  
  </code></pre>