title: How can I pass object from servlet to JSP?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/12033092/how-to-pass-an-object-from-the-servlet-to-the-calling-jsp">How to pass an Object from the servlet to the calling JSP</a>  </p>
  </blockquote>
  
  
  
  <p>How can I pass object from servlet to JSP?</p>
  
  <p>I have used the following code in the servlet side</p>
  
  <pre><code>request.setAttribute("ID", "MyID");
  request.setAttribute("Name", "MyName");
  RequestDispatcher dispatcher = request.getRequestDispatcher("MangeNotifications.jsp");  
  if (dispatcher != null){  
  dispatcher.forward(request, response);  
  }
  </code></pre>
  
  <p>and this code in JSP side</p>
  
  <pre><code>    &lt;td&gt;&lt;%out.println(request.getAttribute("ID"));%&gt; &lt;/td&gt;
      &lt;td&gt;&lt;%out.println(request.getAttribute("Name"));%&gt; &lt;/td&gt;
  </code></pre>
  
  <p>I get null results in the JSP Page</p>