diff --git a/src/main/java/io/hardingadonis/saledock/controller/management/customer/CustomerServlet.java b/src/main/java/io/hardingadonis/saledock/controller/management/customer/CustomerServlet.java index c710879..511edd9 100644 --- a/src/main/java/io/hardingadonis/saledock/controller/management/customer/CustomerServlet.java +++ b/src/main/java/io/hardingadonis/saledock/controller/management/customer/CustomerServlet.java @@ -21,9 +21,18 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) int pageSize = 10; // Get the requested page number - String pageStr = request.getParameter("page"); - if (pageStr != null) { - pageNumber = Integer.parseInt(pageStr); +// String pageStr = request.getParameter("page"); +// if (pageStr != null) { +// pageNumber = Integer.parseInt(pageStr); +// } + + if (request.getParameter("page") != null) { + try { + pageNumber = Integer.parseInt(request.getParameter("page")); + } catch (Exception e) { + response.sendRedirect("./error-404"); + return; + } } List customers = Singleton.customerDAO.pagination((pageNumber - 1) * pageSize, pageSize); @@ -38,7 +47,6 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) request.setAttribute("totalPages", totalPages); request.setAttribute("pageSize", pageSize); request.setAttribute("page", "customer"); - request.getRequestDispatcher("/view/jsp/management/customer/customer.jsp").forward(request, response); }