protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        String categoryid = request.getParameter("categoryid");
        String productname = request.getParameter("productname");
        String productprice = request.getParameter("productprice");
        String stockinhand = request.getParameter("stockinhand");
        String dangerlevel = request.getParameter("dangerlevel");

        productBean bean = new productBean();
        productDAO rd = new productDAO();
        if ((categoryid != null) && (productname != null) && (productprice != null) && (stockinhand != null) && (dangerlevel != null)) {
            bean.setCategoryid(Integer.parseInt(categoryid));
            bean.setProductname(productname);
            bean.setProductprice(Float.parseFloat(productprice));
            bean.setStockinhand(Integer.parseInt(stockinhand));
            bean.setDangerlevel(Integer.parseInt(dangerlevel));

        }
        int id = 0;
        try {
            String opn = request.getParameter("opn");
            if (opn.equals("add")) {
                rd.create(bean);
            } else if (opn.equals("update")) {
                id = Integer.parseInt(request.getParameter("productid"));
                System.out.println(id);
                bean.setProductid(id);
                rd.edit(bean);
            } else if (opn.equals("delete")) {
                id = Integer.parseInt(request.getParameter("productid"));
                bean.setProductid(id);
                rd.remove(id);
            }
             else if (opn.equals("findid")) {
                id = Integer.parseInt(request.getParameter("productid"));
                bean.setProductid(id);
                rd.find(id);
            }
            out.println("{\"status\":\"success\"}");
        } finally {
        }
    }