protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        HttpSession session = request.getSession(true);
        
        Connection connection = DBAccess.getConnection();
        try {
            Class.forName("org.postgresql.Driver");
            
            String sqlStatement;
            ResultSet resultSet;
            Statement statement = connection.createStatement();
            
            out.println("<!DOCTYPE html>");
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Servlet adminStatistics</title>");            
            out.println("</head>");
            out.println("<body>");
            
            String username=request.getParameter("username");
            String password=request.getParameter("password");
            boolean valid=false;
            
            sqlStatement="SELECT * FROM admin;";
            resultSet = statement.executeQuery(sqlStatement);            
            
            resultSet.next();
          
            if (resultSet.getString("username").equals(username) && resultSet.getString("password").equals(password)){
                valid=true;
            }
            
            
            if (valid==true){    
            }else{
                session.setAttribute("error", "The username or password is incorrect");
                response.sendRedirect("StartPage");
                return;
            }
            
            sqlStatement="SELECT COUNT(username) FROM users;";
            resultSet = statement.executeQuery(sqlStatement);            
            while(resultSet.next())
            {
                out.println("Number of users: "+resultSet.getInt("count")+"<br><br>");
            }
            
            sqlStatement="SELECT COUNT(schoolname) FROM schools;";
            resultSet = statement.executeQuery(sqlStatement);
            while(resultSet.next())
            {
                out.println("Number of schools: "+resultSet.getInt("count")+"<br><br>");
            }
            
            sqlStatement="SELECT users.username,schoolname,count(messageID) FROM users,schoolattendance,messages WHERE users.username=schoolattendance.username and users.username=messages.sender GROUP BY users.username, schoolname;";
            resultSet = statement.executeQuery(sqlStatement); 
            out.println("<table border=\"1\"");
                out.println("<tr>");
                out.println("<th>"+"User"+"</th>");
                out.println("<th>"+"School"+"</th>");
                out.println("<th>"+"Message count"+"</th>");
            while(resultSet.next())
            {
                out.println("<tr>");
                out.println("<td>"+resultSet.getString("username")+"</td>");
                out.println("<td>"+resultSet.getString("schoolname")+"</td>");
                out.println("<td>"+resultSet.getInt("count")+"</td>");
                out.println("</tr>");
            }
            out.println("</table><br><br>");
            
            sqlStatement="SELECT schools.schoolname,count(userName) FROM schools,schoolattendance WHERE schools.schoolname=schoolattendance.schoolname GROUP BY schools.schoolname;";
            resultSet = statement.executeQuery(sqlStatement); 

            out.println("<table border=\"1\"");
                out.println("<tr>");
                out.println("<th>"+"School"+"</th>");
                out.println("<th>"+"Number of alumni"+"</th>");
            while(resultSet.next())
            {
                out.println("<tr>");
                out.println("<td>"+resultSet.getString("schoolname")+"</td>");
                out.println("<td>"+resultSet.getInt("count")+"</td>");
                out.println("</tr>");
            }
            out.println("</table>");
            
            out.println("</body>");
            out.println("</html>");
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Admin.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(Admin.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            out.close();
        }
        
        DBAccess.closeConnection(connection);
    }