public void update(HttpServletRequest request, HttpServletResponse response) throws Exception { RewardDivideTax rewardDivideTax = new RewardDivideTax(db); bindForm(rewardDivideTax); rewardDivideTax = rewardDivideTax.update(); if (rewardDivideTax != null) { request.setAttribute("rewardDivideTax", rewardDivideTax); formHandler.setFormMessage("Update Completed"); } else { formHandler.setFormMessage("Update Failed"); } forward("?page=/web/rewardDivideTaxEdit.jsp"); }
public void create(HttpServletRequest request, HttpServletResponse response) throws Exception { RewardDivideTax rewardDivideTax = new RewardDivideTax(db); bindForm(rewardDivideTax); rewardDivideTax = rewardDivideTax.create(); if (rewardDivideTax != null) formHandler.setFormMessage( "Create Completed ,view <a href='process2?action=RewardDivideTax&cmd=view&id=" + rewardDivideTax.getId() + "' target='_blank'>new Record</a>"); else formHandler.setFormMessage("Create Not Complete"); redirect("process2?action=RewardDivideTax&cmd=add"); }
// update public void edit(HttpServletRequest request, HttpServletResponse response) throws Exception { String id = request.getParameter("id"); if (id != null && !id.trim().equals("")) { RewardDivideTax rewardDivideTax = new RewardDivideTax(db); rewardDivideTax = rewardDivideTax.findByPk(new Long(id)); if (rewardDivideTax != null) { request.setAttribute("rewardDivideTax", rewardDivideTax); } else { formHandler.setFormMessage("Error : Not Found with id " + id); } } forward("?page=/web/rewardDivideTaxEdit.jsp"); }
// delete public void delete(HttpServletRequest request, HttpServletResponse response) throws Exception { String[] ids = request.getParameterValues("id"); if (ids != null && ids.length > 0) { RewardDivideTax rewardDivideTax = new RewardDivideTax(db); List<Long> idList = new ArrayList<Long>(); for (int i = 0; i < ids.length; i++) idList.add(new Long(ids[i])); int deleteRow = rewardDivideTax.deleteByPks(idList); formHandler.setFormMessage(" Delete " + deleteRow + " Row Completed "); } else { formHandler.setFormMessage("Plese Select At Least One For Delete"); } redirect("process2?action=RewardDivideTax&cmd=list"); }
// list public void list(HttpServletRequest request, HttpServletResponse response) throws Exception { RewardDivideTax rewardDivideTax = new RewardDivideTax(db); // pageUtil.setPageSize(15); Integer totalRow = rewardDivideTax.countAll(); // set TotalRow pageUtil.setTotalRow(totalRow); List<RewardDivideTax> rewardDivideTaxs = rewardDivideTax.findAll(pageUtil); // for data to display request.setAttribute("rewardDivideTaxs", rewardDivideTaxs); // for screen to show forward("?page=/web/rewardDivideTaxList.jsp"); }