title: call a function inside a servlet from ng-click
body: <p>how can i call a function inside a servlet from ng-click - angular js ?</p>
  
  <p>I have a servlet to get the list of all books in database using hibernate. I want to call that function from my html page when i hit a button using ng-click</p>
  
  <p>this is the html div where i want ng-click to call the function</p>
  
  <pre><code>&lt;div class="col-sm-3 bg-success" ng-click = "go('/ViewAllBooks'); "&gt;
  &lt;h2&gt;View All Books &lt;/h2&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>here is the function inside a servlet that i want to call \</p>
  
  <pre><code>    public void listEmployees( ){
  
              Configuration cfg=new Configuration();  
              cfg.configure("hibernate.cfg.xml");
  
              SessionFactory factory=cfg.buildSessionFactory();  
              Session session = factory.openSession();
              Transaction tx = null;
  
              try{
                 tx = session.beginTransaction();
                 List books = session.createQuery("FROM Books").list(); 
                 for (Iterator iterator = 
                                   books.iterator(); iterator.hasNext();){
                    Books b = (Books) iterator.next(); 
                    System.out.print("First Name: " + b.getName()); 
                    System.out.print(" Last Name: " + b.getAuthor()); 
                    System.out.println("Salary: " + b.getDescription()); 
                 }
                 tx.commit();
              }
              catch (HibernateException e) {
                 if (tx!=null) tx.rollback();
                 e.printStackTrace(); 
              }
              finally {
                 session.close(); 
              }
  
  
          }
  </code></pre>