protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException, ClassNotFoundException, SQLException {
        Authenticator auth = new Authenticator(request);
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        try {
            if(!auth.Login()) {
                response.sendRedirect("login.jsp");
            }
            int table_id; String str; int start_index; int max_fetch;
            if(request.getParameter("table_no") != null && request.getParameter("query") != null && request.getParameter("starting_index")!=null && request.getParameter("max_results")!=null) {
                table_id = Integer.parseInt(request.getParameter("table_no"));
                str = request.getParameter("query");
                start_index = Integer.parseInt(request.getParameter("starting_index"));
                max_fetch = Integer.parseInt(request.getParameter("max_results"));
                try {
                    out.println(mainSearch.query(table_id, str, start_index, max_fetch));
                } catch (Exception ex) {
                    Logger.getLogger(Search.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        } finally {            
            out.close();
        }
    }