public ModelAndView addOrganizationIdentifier( HttpServletRequest request, Object cmd, Errors error) { Map<String, Boolean> map = new HashMap<String, Boolean>(); ModelAndView modelAndView = new ModelAndView(getAjaxViewName(request), map); ParticipantInputCommand command = (ParticipantInputCommand) cmd; List<OrganizationAssignedIdentifier> list = command.getParticipant().getOrganizationIdentifiers(); // store the new index for the new Identifier int size = list.size(); Integer[] indexes = new Integer[] {size}; modelAndView.getModel().put("indexes", indexes); // store the new Identifier object into the command.participant OrganizationAssignedIdentifier newIdentifier = new OrganizationAssignedIdentifier(); newIdentifier.setOrganization(organizationDao.getById(1)); command.getParticipant().addIdentifier(newIdentifier); return modelAndView; }