Hi I have a problem in my jsp and java assignment. I am using a method that returns an integer of number of contacts in my database. this is my code (method).

 public int getContactCount() throws SQLException{
        int counter = 0;
        int counter2 =0;
        int total = 0;
        String query = "";
                query = "SELECT id FROM businesscontact";
                String query2 = "SELECT id FROM residentialcontact";
           
            db.connectMethod();
            PreparedStatement ps = (PreparedStatement)conn.prepareStatement(query);
            ResultSet results = (ResultSet)ps.executeQuery();
            while(results.next()){
                counter++;
            }
             PreparedStatement ps2 = (PreparedStatement)conn.prepareStatement(query2);
            ResultSet results2 = (ResultSet)ps.executeQuery();
            while(results2.next()){
                counter++;
            }
            total = counter + counter2;
            db.disconnectMethod();
           
        return total;
    }

I am calling that method in my jsp page. This is the code

<%@page import="db.dbOperations"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>


   
       
        Number Of Contacts
   
   
       

Total Number Of Contacts


        <% dbOperations db = new dbOperations();
        int counter = db.getContactCount();
        %>
       

The total number of contacts is:<%=counter%>


       
   


Anyone can help why I have a problem please ?