title: Difference between session.getAttribute("someString") vs session.getServletContext().getAttribute("someString")
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2076389/servletcontext-and-session-object">ServletContext and Session object</a>  </p>
  </blockquote>
  
  
  
  <p>I am finding it strange that </p>
  
  <pre><code>session.getAttribute("someString");
  </code></pre>
  
  <p>works while </p>
  
  <pre><code>session.getServletContext().getAttribute("someString");
  </code></pre>
  
  <p>does not <strong>always</strong> work.</p>
  
  <p>I am adding objects to session by getting HttpSession object from HttpServletRequest request with </p>
  
  <pre><code>request.getSession().setAttribute("someString")
  </code></pre>