title: How to create Dynamic Array
body: <p>What would be the best way to create a dynamic array for a user to add products to a basket then store them in a session variable, I have been told serilizable arrays would work however when looking online for a solution I came accross an <code>ArrayList</code> which seemed perfect but I can't seem to implement it.</p>
  
  <p>I have a separate class called <code>Basket</code> with:</p>
  
  <pre><code>ArrayList basketItems = new ArrayList();
  </code></pre>
  
  <p>I need to be able to select a product from a gridview using the select link or alternatively using a listview and using my own button to then add the <code>bookID</code> to the array, which will then be stored in a session variable and sent to a basket page where the <code>bookID</code> will be used again against a SQL table to output the details of the book etc.</p>