if (personListFinded == null || personListFinded.size() < 2) { errors.add("impossibleFindPerson", new ActionError("error.manager.implossible.findPerson")); }
    public ActionForward findPerson(ActionMapping mapping, ActionForm actionForm,            HttpServletRequest request, HttpServletResponse response) throws Exception {        ActionErrors errors = new ActionErrors();        IUserView userView = SessionUtils.getUserView(request);        DynaActionForm findPersonForm = (DynaActionForm) actionForm;        String name = null;        if (request.getParameter("name") != null && request.getParameter("name").length() > 0) {            name = request.getParameter("name");        } else if (findPersonForm.get("name") != null) {            name = (String) findPersonForm.get("name");        }        Integer startIndex = null;        if (request.getParameter("startIndex") != null                && request.getParameter("startIndex").length() > 0) {            startIndex = new Integer(request.getParameter("startIndex"));        } else if (findPersonForm.get("startIndex") != null) {            startIndex = new Integer((String) findPersonForm.get("startIndex"));        }        String roleType = null;        Integer departmentId = null;        Integer degreeId = null;        String degreeType = null;        if (request.getParameter("roleType") != null && request.getParameter("roleType").length() > 0) {            roleType = (String) request.getParameter("roleType");        } else if (findPersonForm.get("roleType") != null) {            roleType = (String) findPersonForm.get("roleType");        }        if (request.getParameter("degreeType") != null                && request.getParameter("degreeType").length() > 0) {            degreeType = (String) request.getParameter("degreeType");        } else if (findPersonForm.get("degreeType") != null) {            degreeType = (String) findPersonForm.get("degreeType");        }        if (request.getParameter("departmentId") != null                && request.getParameter("departmentId").length() > 0) {            departmentId = Integer.valueOf(request.getParameter("departmentId"));        } else if (findPersonForm.get("departmentId") != null) {            departmentId = (Integer) findPersonForm.get("departmentId");        }        if (request.getParameter("degreeId") != null && request.getParameter("degreeId").length() > 0) {            degreeId = Integer.valueOf(request.getParameter("degreeId"));        } else if (findPersonForm.get("degreeId") != null) {            degreeId = (Integer) findPersonForm.get("degreeId");        }        HashMap parametersSearch = new HashMap();        parametersSearch.put(new String("name"), name);        parametersSearch.put(new String("startIndex"), startIndex);        parametersSearch.put(new String("numberOfElements"), new Integer(                SessionConstants.LIMIT_FINDED_PERSONS - 1));        parametersSearch.put(new String("roleType"), roleType);        if (degreeId != null) {            parametersSearch.put(new String("degreeId"), new Integer(degreeId));        }        if (departmentId != null) {            parametersSearch.put(new String("departmentId"), new Integer(departmentId));        }        parametersSearch.put(new String("degreeType"), degreeType);        Object[] args = { parametersSearch };        List personListFinded = null;        try {            personListFinded = (List) ServiceManagerServiceFactory.executeService(userView,                    "SearchPerson", args);        } catch (FenixServiceException e) {            e.printStackTrace();            errors.add("impossibleFindPerson", new ActionError("error.manager.implossible.findPerson"));        }        if (personListFinded == null || personListFinded.size() < 2) {            errors.add("impossibleFindPerson", new ActionError("error.manager.implossible.findPerson"));        }        List infoPerson = (List) personListFinded.get(1);        if (infoPerson.isEmpty()) {            findPersonForm.set("roleType", "");            findPersonForm.set("name", "");            errors.add("impossibleFindPerson", new ActionError("error.manager.implossible.findPerson"));            saveErrors(request, errors);        }        if (!errors.isEmpty()) {            saveErrors(request, errors);            return mapping.getInputForward();        }        request.setAttribute("totalFindedPersons", personListFinded.get(0));        request.setAttribute("personListFinded", infoPerson);        request.setAttribute("name", name);        request.setAttribute("roleType", roleType);        request.setAttribute("degreeType", degreeType);        request.setAttribute("degreeId", degreeId);        request.setAttribute("departmentId", departmentId);                if ((Integer) personListFinded.get(2) - (Integer) personListFinded.get(3) != SessionConstants.LIMIT_FINDED_PERSONS) {            request.setAttribute("previousStartIndex",                    ((Integer) personListFinded.get(2) - SessionConstants.LIMIT_FINDED_PERSONS)                            - ((Integer) personListFinded.get(2) - (Integer) personListFinded.get(3)));        } else {            request.setAttribute("previousStartIndex",                    ((Integer) personListFinded.get(2) - ( 2 * SessionConstants.LIMIT_FINDED_PERSONS)));        }               request.setAttribute("startIndex", (Integer) personListFinded.get(2));        if (isEmployeeOrTeacher(userView)) {            request.setAttribute("show", Boolean.TRUE);        } else {            request.setAttribute("show", Boolean.FALSE);        }        Boolean viewPhoto = getCheckBoxValue((String) findPersonForm.get("viewPhoto"));        request.setAttribute("viewPhoto", viewPhoto);        return mapping.findForward("displayPerson");    }