editStudentCurricularPlanForm.set("credits", String.valueOf(infoStudentCurricularPlan .getGivenCredits()));
editStudentCurricularPlanForm.set("credits", (infoStudentCurricularPlan.getGivenCredits() == null) ? "0.0" : String .valueOf(infoStudentCurricularPlan.getGivenCredits()));
    public ActionForward prepare(ActionMapping mapping, ActionForm form, HttpServletRequest request,            HttpServletResponse response) throws Exception {        HttpSession session = request.getSession(false);        DynaActionForm editStudentCurricularPlanForm = (DynaActionForm) form;        Integer studentCurricularPlanId = new Integer(getFromRequest("studentCurricularPlanId", request));        IUserView userView = (IUserView) session.getAttribute(SessionConstants.U_VIEW);        Object args[] = { studentCurricularPlanId };        InfoStudentCurricularPlan infoStudentCurricularPlan = null;        try {            infoStudentCurricularPlan = (InfoStudentCurricularPlan) ServiceManagerServiceFactory                    .executeService(userView, "ReadPosGradStudentCurricularPlanById", args);        } catch (FenixServiceException e) {            throw new FenixActionException(e);        }        Object argsBranches[] = { infoStudentCurricularPlan.getInfoDegreeCurricularPlan()                .getIdInternal() };        List branchList = null;        try {            branchList = (List) ServiceManagerServiceFactory.executeService(userView,                    "ReadBranchesByDegreeCurricularPlanId", argsBranches);        } catch (FenixServiceException e) {            throw new FenixActionException(e);        }        // put request        request.setAttribute(SessionConstants.BRANCH, branchList);        request.setAttribute("currentState", infoStudentCurricularPlan.getCurrentState());        request.setAttribute("student", infoStudentCurricularPlan.getInfoStudent());        request.setAttribute("studentCurricularPlan", infoStudentCurricularPlan);        editStudentCurricularPlanForm.set("specialization", infoStudentCurricularPlan                .getSpecialization().toString());        if (infoStudentCurricularPlan.getInfoBranch() != null) {            editStudentCurricularPlanForm.set("branch", infoStudentCurricularPlan.getInfoBranch()                    .getIdInternal());        }        editStudentCurricularPlanForm.set("currentState", infoStudentCurricularPlan.getCurrentState()                .toString());        editStudentCurricularPlanForm.set("credits", String.valueOf(infoStudentCurricularPlan                .getGivenCredits()));        editStudentCurricularPlanForm                .set("startDate", infoStudentCurricularPlan.getStartDateFormatted());        String[] formValues = new String[infoStudentCurricularPlan.getInfoEnrolments().size()];        int i = 0;        for (Iterator iter = infoStudentCurricularPlan.getInfoEnrolments().iterator(); iter.hasNext();) {            Object enrollment = iter.next();            if (enrollment instanceof InfoEnrolmentInExtraCurricularCourse) {                Integer enrollmentId = ((InfoEnrolmentInExtraCurricularCourse) enrollment)                        .getIdInternal();                formValues[i] = enrollmentId.toString();            }            i++;        }        DynaActionForm coursesForm = (DynaActionForm) form;        coursesForm.set("extraCurricularCourses", formValues);        return mapping.findForward("editStudentCurricularCoursePlan");    }