List infoPaymentPhases = collectPaymentPhases(gratuityForm);
List<InfoPaymentPhase> infoPaymentPhases = collectPaymentPhases(gratuityForm);
    public ActionForward addPhase(ActionMapping mapping, ActionForm form, HttpServletRequest request,            HttpServletResponse response) {        ActionErrors errors = new ActionErrors();        DynaValidatorForm gratuityForm = (DynaValidatorForm) form;        String initialDate = (String) gratuityForm.get("initialDatePartialPayment");        String finalDate = (String) gratuityForm.get("finalDatePartialPayment");        String phaseValue = (String) gratuityForm.get("phaseValue");        maintainState(request, gratuityForm);        List infoPaymentPhases = collectPaymentPhases(gratuityForm);        if (finalDate == null || finalDate.length() == 0 || phaseValue == null                || phaseValue.length() == 0) {            errors.add("wrongValues", new ActionError("error.masterDegree.gratuity.phaseValues"));            saveErrors(request, errors);        }        if (errors.isEmpty()) {            if (initialDate == null                    || initialDate.length() == 0                    || (initialDate.length() > 0 && !Data.convertStringDate(finalDate, "/").before(                            Data.convertStringDate(initialDate, "/")))) {                fillPaymentPhasesList(initialDate, finalDate, phaseValue, infoPaymentPhases);            } else {                errors                        .add("wrongDates", new ActionError(                                "error.masterDegree.gratuity.phase.wrongDates"));                saveErrors(request, errors);            }        }        Collections.sort(infoPaymentPhases, new BeanComparator("endDate"));        request.setAttribute("infoPaymentPhases", infoPaymentPhases);        return mapping.findForward("insertGratuityData");    }