private void sendNotification(ArrayList<Integer> idlist) { userDAO = new UserDao(); emailnotification = new EmailNotification(); for (Integer i : idlist) { try { User u = userDAO.find(i); emailnotification.sendVIPStatusNotification(u.getEmail(), u.getName(), true); } catch (MyException e) { e .printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } } }
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws MyException, IOException { // If User is not Sales Manager or Administrator if (request.getSession().getAttribute("utype") == null || (request.getSession().getAttribute("utype").toString()).equals("1")) { return "home"; } UserDao uDao = new UserDao(); boolean flag = true; // uDao.updateForSM(521); // request.getParameterValues("vip"); String[] users = request.getParameterValues("vip[]"); ArrayList<Integer> idlist = new ArrayList<Integer>(); idlist = getIntegerList(users); for (int i = 0; i < idlist.size(); i++) { flag = uDao.updateForSM(idlist.get(i)); } sendNotification(idlist); return "smsettings"; }