title: Servlet send arraylist to JSP as request attribute
body: <p>I am attempting to send an ArrayList from a servlet to a JSP page.  In the Servlet:</p>
  
  <pre><code>List&lt;ItemObj&gt; myList = new ArrayList&lt;ItemObj&gt;();   
  req.setAttribute("list", myList);
  req.getRequestDispatcher("page.jsp").forward(req,resp);
  </code></pre>
  
  <p>In the JSP:</p>
  
  <pre><code>&lt;% List&lt;ItemObj&gt; myList = (ArrayList&lt;ItemObj&gt;) request.getParameter("list"); %&gt;
  </code></pre>
  
  <p>However, I keep getting an error: Cannot cast from String to List.  I have found sources that indicate that I can cast as such: </p>
  
  <p><a href="https://stackoverflow.com/questions/17988612/how-to-send-arraylist-from-jsp-to-servlet">how to send ArrayList from jsp to servlet</a></p>
  
  <p><a href="https://stackoverflow.com/questions/9360223/send-array-of-objects-from-servlet-to-jsp">Send array of objects from servlet to JSP</a></p>
  
  <p>What am I doing wrong?  Thank you!</p>