As far as I know, it is not a client side issue as I am able to perform this action via checking network logs on chrome, not sure how do I check the server logs via GlassFish though..
Also an additional question I have for the current assignment im working on, as you can see this is a code regarding an online shopping system, for the cart menu, it is meant to be hidden before clicking on the cart icon, and to shrink after pressing 'X'. But after using this servlet, the page was forced to refresh and the cart is closed again.. How do i leave it on? (cz the + and - can be clicked on multiple times in a row)
package servlet;import da.CartDA;import domain.Cart;import java.io.IOException;import java.io.PrintWriter;import java.sql.SQLException;import java.util.HashSet;import java.util.Set;import java.util.logging.Level;import java.util.logging.Logger;import javax.servlet.RequestDispatcher;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;@WebServlet("/update-cart")public class UpdateCartItemController extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { String cartId = request.getParameter("cartId"); int cartQty = Integer.parseInt(request.getParameter("cartQty")); String action = request.getParameter("action"); if (action != null && cartId != null) { CartDA cartDA = new CartDA(); try { Cart cart = cartDA.getCartByCartId(cartId); if (cart != null) { if ("increase".equals(action)){ cartQty++; }else if ("decrease".equals(action)){ cartQty--; } cart.setQuantity(cartQty); cartDA.updateCartQty(cartId, cartQty); } } catch (SQLException e) { e.printStackTrace(); // Handle SQL errors } } } catch (Exception ex) { log("SQL Exception: ", ex); request.setAttribute("errorMessage", "Database error occurred."); request.getRequestDispatcher("/error.jsp").forward(request, response); } }}