Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #157 from hardingadonis/Thuy-fix-bug154
Browse files Browse the repository at this point in the history
Thúy- fix bug 154 (Completed)
  • Loading branch information
bakaqc authored Mar 7, 2024
2 parents ccbf8b2 + 26e70c4 commit 010184c
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
int pageNumber = 1;
int pageSize = 10;

// Get the requested page number
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<Customer> customers = Singleton.customerDAO.pagination((pageNumber - 1) * pageSize, pageSize);
Expand All @@ -38,7 +41,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);
}
Expand Down

0 comments on commit 010184c

Please sign in to comment.