title: Printing out elements of a list using servlet
body: <p>I have this list of books and I`d like to know how can I print out all of the list elements using servlet. I am sure there is some fairly easy way to do it, but I do not know how. </p>
  
  <pre><code>public List&lt;BookInfo&gt; listBooks() {
     EntityManager em = EMFService.get().createEntityManager();
     // read the existing entries
     Query q = em.createQuery("select m from BookInfo m");
     List&lt;BookInfo&gt; books = q.getResultList();
     return books;
  }
  </code></pre>