title: Importing and retrieving a class object in a jsp
body: <p>I am trying to retrieve an array list object of type <code>QueryClass</code> from a servlet I have made and import the class of the <code>QueryClass</code> so I can use the object in my jsp called <code>validate.jsp</code>" but the object seems not to exist when I get the attribute in the jsp file, though in my servlet its initialized with the appropriate data and I set it with the right name.</p>
  
  <p>In my servlet I have this snippet</p>
  
  <pre><code>QueryClass query = new QueryClass("","","","");
  
  String searchName = request.getParameter("searchName");
  
  ArrayList&lt;QueryClass&gt; data = query.getSearchedNames(searchName);
  
  request.setAttribute("data",data);  
  
  RequestDispatcher rd = request.getRequestDispatcher("validate.jsp");
  
  rd.forward(request, response);
  </code></pre>
  
  <p>In my jsp I have the following</p>
  
  <pre><code>&lt;%@page import="src.main.java.QueryClass"%&gt;
  
  &lt;%
  if(request.getAttribute("data")!=null) 
  {
      ArrayList&lt;QueryClass&gt; value = (ArrayList&lt;QueryClass&gt;)request.getAttribute("data");
  }
  %&gt;
  </code></pre>