Integer executionYear = null;
String executionYearString = null;
    public ActionForward coordinatorStudentsGratuityList(ActionMapping mapping, ActionForm actionForm,            HttpServletRequest request, HttpServletResponse response) throws Exception {        ActionErrors errors = new ActionErrors();        HttpSession session = request.getSession();        DynaActionForm studentGratuityListForm = (DynaActionForm) actionForm;        IUserView userView = (IUserView) session.getAttribute(SessionConstants.U_VIEW);        // data from request        Integer executionYear = null;        Integer degreeCurricularPlanID = null;        String orderingType = null;        try {            orderingType = request.getParameter("order");            if (orderingType != null) {                executionYear = new Integer(Integer.parseInt(request.getParameter("chosenYear")));                degreeCurricularPlanID = new Integer(Integer.parseInt(request                        .getParameter("degreeCurricularPlanID")));            } else {                executionYear = (Integer) studentGratuityListForm.get("chosenYear");                degreeCurricularPlanID = (Integer) studentGratuityListForm.get("degreeCurricularPlanID");                orderingType = (String) studentGratuityListForm.get("order");            }        } catch (NumberFormatException nfe) {            errors.add("requestParameters", new ActionError(                    "error.masterDegree.gratuity.impossible.studentsGratuityList"));            return mapping.getInputForward();        }        Object[] args = { degreeCurricularPlanID, executionYear };        InfoExecutionDegree infoExecutionDegree = null;        try {            infoExecutionDegree = (InfoExecutionDegree) ServiceManagerServiceFactory.executeService(                    userView, "ReadExecutionDegreeByDegreeCurricularPlanID", args);        } catch (FenixServiceException exception) {            exception.printStackTrace();            saveErrors(request, errors);            return mapping.getInputForward();        }        // required data        String degree = new String(infoExecutionDegree.getInfoDegreeCurricularPlan().getInfoDegree()                .getTipoCurso().toString()                + " em " + infoExecutionDegree.getInfoDegreeCurricularPlan().getInfoDegree().getNome());        String specialization = "all";        String situation = "all";        Object[] yearArgs = { degreeCurricularPlanID };        List executionYearList = null;        try {            executionYearList = (List) ServiceManagerServiceFactory.executeService(userView,                    "ReadExecutionYearsByDegreeCurricularPlanID", yearArgs);        } catch (FenixServiceException exception) {            exception.printStackTrace();            saveErrors(request, errors);            return mapping.getInputForward();        }        String year1 = ((InfoExecutionYear) executionYearList.get(0)).getYear();        String year2 = ((InfoExecutionYear) executionYearList.get(1)).getYear();        // String year1 = null;        // String year2 = null;        // if(executionYear.equals(new Integer(1))){        // //first year selected        // year1 = new String((executionDegreeDate.getYear()+1900) + "/" +        // (executionDegreeDate.getYear()+1901));        // year2 = new String((executionDegreeDate.getYear()+1901) + "/" +        // (executionDegreeDate.getYear()+1902));        // }        // else{        // //second year selected        // year1 = new String((executionDegreeDate.getYear()+1899) + "/" +        // (executionDegreeDate.getYear()+1900));        // year2 = new String((executionDegreeDate.getYear()+1900) + "/" +        // (executionDegreeDate.getYear()+1901));        // }        // getting the gratuity list        Object[] gratuityArgs = { infoExecutionDegree.getIdInternal(),                infoExecutionDegree.getInfoExecutionYear().getYear(), specialization, situation };        HashMap gratuityList = null;        try {            gratuityList = (HashMap) ServiceManagerServiceFactory.executeService(userView,                    "ReadGratuitySituationListByExecutionDegreeAndSpecialization", gratuityArgs);        } catch (FenixServiceException exception) {            exception.printStackTrace();            saveErrors(request, errors);            // return mapping.getInputForward();        }        if (gratuityList == null) {            errors.add("noList", new ActionError(                    "error.masterDegree.gratuity.impossible.studentsGratuityList"));            saveErrors(request, errors);            return mapping.getInputForward();        }        // order list        List infoGratuitySituationList = (List) gratuityList.get(new Integer(0));        orderList(infoGratuitySituationList, orderingType);        // getting total values        Double totalPayedValue = (Double) gratuityList.get(new Integer(1));        Double totalRemaingValue = (Double) gratuityList.get(new Integer(2));        // setting data onto request        request.setAttribute("totalPayedValue", totalPayedValue);        request.setAttribute("totalRemaingValue", totalRemaingValue);        request.setAttribute("degreeCurricularPlanID", degreeCurricularPlanID);        request.setAttribute("year1", year1);        request.setAttribute("year2", year2);        request.setAttribute("degree", degree);        request.setAttribute("chosenYear", executionYear);        request.setAttribute("order", orderingType);        request.setAttribute("infoGratuitySituationList", infoGratuitySituationList);        if (executionYear.equals(new Integer(1))) {            request.setAttribute("executionYear", year1);        } else {            request.setAttribute("executionYear", year2);        }        return mapping.findForward("studentsGratuityList");    }