Java Code Examples for org.springframework.validation.BindingResult#rejectValue()

The following examples show how to use org.springframework.validation.BindingResult#rejectValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventsController.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@PostMapping(value = "/new")
public String createEvent(@Valid CreateEventForm createEventForm, BindingResult result,
        RedirectAttributes redirectAttributes) {
    if (result.hasErrors()) {
        return "events/create";
    }
    CalendarUser attendee = calendarService.findUserByEmail(createEventForm.getAttendeeEmail());
    if (attendee == null) {
        result.rejectValue("attendeeEmail", "attendeeEmail.missing",
                "Could not find a user for the provided Attendee Email");
    }
    if (result.hasErrors()) {
        return "events/create";
    }
    Event event = new Event();
    event.setAttendee(attendee);
    event.setDescription(createEventForm.getDescription());
    event.setOwner(userContext.getCurrentUser());
    event.setSummary(createEventForm.getSummary());
    event.setWhen(createEventForm.getWhen());
    calendarService.createEvent(event);
    redirectAttributes.addFlashAttribute("message",
            "Successfully added the new event");
    return "redirect:/events/my";
}
 
Example 2
Source File: SignupController.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@RequestMapping(value="/signup/new",method=RequestMethod.POST)
public String signup(@Valid SignupForm signupForm, BindingResult result, RedirectAttributes redirectAttributes) {
    if(result.hasErrors()) {
        return "signup/form";
    }

    String email = signupForm.getEmail();
    if(calendarService.findUserByEmail(email) != null) {
        result.rejectValue("email", "errors.signup.email", "Email address is already in use.");
        return "signup/form";
    }

    CalendarUser user = new CalendarUser();
    user.setEmail(email);
    user.setFirstName(signupForm.getFirstName());
    user.setLastName(signupForm.getLastName());
    user.setPassword(signupForm.getPassword());

    int id = calendarService.createUser(user);
    user.setId(id);
    userContext.setCurrentUser(user);

    redirectAttributes.addFlashAttribute("message", "You have successfully signed up and logged in.");
    return "redirect:/";
}
 
Example 3
Source File: EventsController.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@RequestMapping(value = "/new", method = RequestMethod.POST)
public String createEvent(@Valid CreateEventForm createEventForm, BindingResult result,
        RedirectAttributes redirectAttributes) {
    if (result.hasErrors()) {
        return "events/create";
    }
    CalendarUser attendee = calendarService.findUserByEmail(createEventForm.getAttendeeEmail());
    if (attendee == null) {
        result.rejectValue("attendeeEmail", "attendeeEmail.missing",
                "Could not find a user for the provided Attendee Email");
    }
    if (result.hasErrors()) {
        return "events/create";
    }
    Event event = new Event();
    event.setAttendee(attendee);
    event.setDescription(createEventForm.getDescription());
    event.setOwner(userContext.getCurrentUser());
    event.setSummary(createEventForm.getSummary());
    event.setWhen(createEventForm.getWhen());
    calendarService.createEvent(event);
    redirectAttributes.addFlashAttribute("message", "Successfully added the new event");
    return "redirect:/events/my";
}
 
Example 4
Source File: EventsController.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@PostMapping(value = "/new")
public String createEvent(@Valid CreateEventForm createEventForm, BindingResult result,
        RedirectAttributes redirectAttributes) {
    if (result.hasErrors()) {
        return "events/create";
    }
    CalendarUser attendee = calendarService.findUserByEmail(createEventForm.getAttendeeEmail());
    if (attendee == null) {
        result.rejectValue("attendeeEmail", "attendeeEmail.missing",
                "Could not find a user for the provided Attendee Email");
    }
    if (result.hasErrors()) {
        return "events/create";
    }
    Event event = new Event();
    event.setAttendee(attendee);
    event.setDescription(createEventForm.getDescription());
    event.setOwner(userContext.getCurrentUser());
    event.setSummary(createEventForm.getSummary());
    event.setWhen(createEventForm.getWhen());
    calendarService.createEvent(event);
    redirectAttributes.addFlashAttribute("message", "Successfully added the new event");
    return "redirect:/events/my";
}
 
Example 5
Source File: LoginController.java    From spring-login with Apache License 2.0 6 votes vote down vote up
@PostMapping(value = "/registration")
public ModelAndView createNewUser(@Valid User user, BindingResult bindingResult) {
    ModelAndView modelAndView = new ModelAndView();
    User userExists = userService.findUserByUserName(user.getUserName());
    if (userExists != null) {
        bindingResult
                .rejectValue("userName", "error.user",
                        "There is already a user registered with the user name provided");
    }
    if (bindingResult.hasErrors()) {
        modelAndView.setViewName("registration");
    } else {
        userService.saveUser(user);
        modelAndView.addObject("successMessage", "User has been registered successfully");
        modelAndView.addObject("user", new User());
        modelAndView.setViewName("registration");

    }
    return modelAndView;
}
 
Example 6
Source File: EventsController.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@PostMapping(value = "/new")
public String createEvent(@Valid CreateEventForm createEventForm, BindingResult result,
                          RedirectAttributes redirectAttributes) {
    if (result.hasErrors()) {
        return "events/create";
    }
    CalendarUser attendee = calendarService.findUserByEmail(createEventForm.getAttendeeEmail());
    if (attendee == null) {
        result.rejectValue("attendeeEmail", "attendeeEmail.missing",
                "Could not find a user for the provided Attendee Email");
    }
    if (result.hasErrors()) {
        return "events/create";
    }
    Event event = new Event();
    event.setAttendee(attendee);
    event.setDescription(createEventForm.getDescription());
    event.setOwner(userContext.getCurrentUser());
    event.setSummary(createEventForm.getSummary());
    event.setWhen(createEventForm.getWhen());
    calendarService.createEvent(event);
    redirectAttributes.addFlashAttribute("message", "Successfully added the new event");
    return "redirect:/events/my";
}
 
Example 7
Source File: EventsController.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@RequestMapping(value = "/new", method = RequestMethod.POST)
public String createEvent(@Valid CreateEventForm createEventForm, BindingResult result,
        RedirectAttributes redirectAttributes) {
    if (result.hasErrors()) {
        return "events/create";
    }
    CalendarUser attendee = calendarService.findUserByEmail(createEventForm.getAttendeeEmail());
    if (attendee == null) {
        result.rejectValue("attendeeEmail", "attendeeEmail.missing",
                "Could not find a user for the provided Attendee Email");
    }
    if (result.hasErrors()) {
        return "events/create";
    }
    Event event = new Event();
    event.setAttendee(attendee);
    event.setDescription(createEventForm.getDescription());
    event.setOwner(userContext.getCurrentUser());
    event.setSummary(createEventForm.getSummary());
    event.setWhen(createEventForm.getWhen());
    calendarService.createEvent(event);
    redirectAttributes.addFlashAttribute("message", "Successfully added the new event");
    return "redirect:/events/my";
}
 
Example 8
Source File: EntityValidator.java    From entando-core with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void validateBodyName(String id, EntityDto request, BindingResult bindingResult) {
    if (!StringUtils.equals(id, request.getId())) {
        bindingResult.rejectValue("id", ERRCODE_URINAME_MISMATCH, new String[]{id, request.getId()}, "entity.id.mismatch");
        throw new ValidationConflictException(bindingResult);
    }
    if (!this.existEntity(id)) {
        bindingResult.reject(ERRCODE_ENTITY_DOES_NOT_EXIST, new String[]{id}, "entity.notExists");
        throw new ResourceNotFoundException(bindingResult);
    }
}
 
Example 9
Source File: EventsController.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@PostMapping(value = "/new")
public String createEvent(@Valid CreateEventForm createEventForm, BindingResult result,
        RedirectAttributes redirectAttributes) {
    if (result.hasErrors()) {
        return "events/create";
    }
    CalendarUser attendee = calendarService.findUserByEmail(createEventForm.getAttendeeEmail());
    if (attendee == null) {
        result.rejectValue("attendeeEmail", "attendeeEmail.missing",
                "Could not find a user for the provided Attendee Email");
    }
    if (result.hasErrors()) {
        return "events/create";
    }
    Event event = new Event();
    event.setAttendee(attendee);
    event.setDescription(createEventForm.getDescription());
    event.setOwner(userContext.getCurrentUser());
    event.setSummary(createEventForm.getSummary());
    event.setWhen(createEventForm.getWhen());
    calendarService.createEvent(event);

    redirectAttributes.addFlashAttribute("message", "Successfully added the new event");

    return "redirect:/events/my";
}
 
Example 10
Source File: SignupController.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@PostMapping(value="/signup/new")
public String signup(@Valid SignupForm signupForm, BindingResult result, RedirectAttributes redirectAttributes) {
    if(result.hasErrors()) {
        return "signup/form";
    }

    String email = signupForm.getEmail();
    if(calendarService.findUserByEmail(email) != null) {
        result.rejectValue("email", "errors.signup.email", "Email address is already in use.");
        return "signup/form";
    }

    CalendarUser user = new CalendarUser();
    user.setEmail(email);
    user.setFirstName(signupForm.getFirstName());
    user.setLastName(signupForm.getLastName());
    user.setPassword(signupForm.getPassword());

    logger.info("CalendarUser: {}", user);

    int id = calendarService.createUser(user);
    user.setId(id);
    userContext.setCurrentUser(user);

    redirectAttributes.addFlashAttribute("message", "You have successfully signed up and logged in.");
    return "redirect:/";
}
 
Example 11
Source File: EventsController.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@PostMapping(value = "/new")
public Map<String, List<?>> createEvent(@Valid CreateEventForm createEventForm,
                          BindingResult bindingResult,
                          RedirectAttributes redirectAttributes) {

    Map<String, List<?>> result = new HashMap<>();

    if (bindingResult.hasErrors()) {
        result.put("bindingResultErrors", bindingResult.getFieldErrors());
        return result;
    }
    CalendarUser attendee = calendarService.findUserByEmail(createEventForm.getAttendeeEmail());

    if (attendee == null) {
        bindingResult.rejectValue("attendeeEmail", "attendeeEmail.missing",
                "Could not find a user for the provided Attendee Email");
    }

    if (bindingResult.hasErrors()) {
        result.put("bindingResultErrors", bindingResult.getFieldErrors());
    }

    Event event = new Event();
    event.setAttendee(attendee);
    event.setDescription(createEventForm.getDescription());
    event.setOwner(userContext.getCurrentUser());
    event.setSummary(createEventForm.getSummary());
    event.setWhen(createEventForm.getWhen());
    int eventId = calendarService.createEvent(event);

    List<String> success = new ArrayList<>();
    success.add(String.valueOf(eventId));
    success.add("Successfully added the new event");

    result.put("message", success);
    return result;
}
 
Example 12
Source File: UserDeleteController.java    From wallride with Apache License 2.0 5 votes vote down vote up
@RequestMapping
public String delete(
		@Valid @ModelAttribute("form") UserDeleteForm form,
		BindingResult errors,
		String query,
		RedirectAttributes redirectAttributes) {
	if (!form.isConfirmed()) {
		errors.rejectValue("confirmed", "Confirmed");
	}
	if (errors.hasErrors()) {
		logger.debug("Errors: {}", errors);
		return "user/describe";
	}

	User deletedUser;
	try {
		deletedUser = userService.deleteUser(form.buildUserDeleteRequest(), errors);
	}
	catch (BindException e) {
		if (errors.hasErrors()) {
			logger.debug("Errors: {}", errors);
			return "user/describe";
		}
		throw new RuntimeException(e);
	}

	redirectAttributes.addFlashAttribute("deletedUser", deletedUser);
	redirectAttributes.addAttribute("query", query);
	return "redirect:/_admin/{language}/users/index";
}
 
Example 13
Source File: SignupController.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@PostMapping(value="/signup/new")
public String signup(@Valid SignupForm signupForm, BindingResult result, RedirectAttributes redirectAttributes) {
    if(result.hasErrors()) {
        return "signup/form";
    }

    String email = signupForm.getEmail();
    if(calendarService.findUserByEmail(email) != null) {
        result.rejectValue("email", "errors.signup.email", "Email address is already in use.");
        return "signup/form";
    }

    CalendarUser user = new CalendarUser();
    user.setEmail(email);
    user.setFirstName(signupForm.getFirstName());
    user.setLastName(signupForm.getLastName());
    user.setPassword(signupForm.getPassword());

    logger.info("CalendarUser: {}", user);

    int id = calendarService.createUser(user);
    user.setId(id);
    userContext.setCurrentUser(user);

    redirectAttributes.addFlashAttribute("message", "You have successfully signed up and logged in.");
    return "redirect:/";
}
 
Example 14
Source File: SignupController.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@PostMapping(value="/signup/new")
public String signup(@Valid SignupForm signupForm, BindingResult result, RedirectAttributes redirectAttributes) {
    if(result.hasErrors()) {
        return "signup/form";
    }

    String email = signupForm.getEmail();
    if(calendarService.findUserByEmail(email) != null) {
        result.rejectValue("email", "errors.signup.email", "Email address is already in use.");
        return "signup/form";
    }

    CalendarUser user = new CalendarUser();
    user.setEmail(email);
    user.setFirstName(signupForm.getFirstName());
    user.setLastName(signupForm.getLastName());
    user.setPassword(signupForm.getPassword());

    logger.info("CalendarUser: {}", user);

    int id = calendarService.createUser(user);
    user.setId(id);
    userContext.setCurrentUser(user);

    redirectAttributes.addFlashAttribute("message", "You have successfully signed up and logged in.");
    return "redirect:/";
}
 
Example 15
Source File: SignupController.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@PostMapping(value="/signup/new")
public String signup(@Valid SignupForm signupForm, BindingResult result, RedirectAttributes redirectAttributes) {
    if(result.hasErrors()) {
        return "signup/form";
    }

    String email = signupForm.getEmail();
    if(calendarService.findUserByEmail(email) != null) {
        result.rejectValue("email", "errors.signup.email", "Email address is already in use.");
        return "signup/form";
    }

    CalendarUser user = new CalendarUser();
    user.setEmail(email);
    user.setFirstName(signupForm.getFirstName());
    user.setLastName(signupForm.getLastName());
    user.setPassword(signupForm.getPassword());

    logger.info("CalendarUser: {}", user);

    int id = calendarService.createUser(user);
    user.setId(id);
    userContext.setCurrentUser(user);

    redirectAttributes.addFlashAttribute("message", "You have successfully signed up and logged in.");
    return "redirect:/";
}
 
Example 16
Source File: DepartmentController.java    From JDeSurvey with GNU Affero General Public License v3.0 5 votes vote down vote up
@Secured({"ROLE_ADMIN"})
@RequestMapping(method = RequestMethod.PUT, produces = "text/html")
public String update(@RequestParam(value = "_proceed", required = false) String proceed,
					 @Valid Department department, 
					 BindingResult bindingResult, 
					 Principal principal,
					 Model uiModel, 
					 HttpServletRequest httpServletRequest) {
	log.info("update(): handles PUT");
	try{
		User user = userService.user_findByLogin(principal.getName());	
		if(proceed != null){


			if (bindingResult.hasErrors()) {
				populateEditForm(uiModel, department,user);
				return "security/departments/update";
			}
			if (surveySettingsService.department_findByName(department.getName()) != null &&
					!surveySettingsService.department_findByName(department.getName()).getId().equals(department.getId())) {
				bindingResult.rejectValue("name", "field_unique");
				populateEditForm(uiModel, department,user);
				return "security/departments/update";
			}
			uiModel.asMap().clear();
			department = surveySettingsService.department_merge(department);
			return "redirect:/security/departments/" + encodeUrlPathSegment(department.getId().toString(), httpServletRequest);

		}else{

			return "redirect:/security/departments?page=1&size=10";

		}


	} catch (Exception e) {
		log.error(e.getMessage(),e);
		throw (new RuntimeException(e));
	}
}
 
Example 17
Source File: UserController.java    From JDeSurvey with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Updates the user information, except password
 * @param proceed
 * @param user
 * @param bindingResult
 * @param principal
 * @param uiModel
 * @param httpServletRequest
 * @return
 */
@Secured({"ROLE_ADMIN"})
@RequestMapping(value = "/pass", method = RequestMethod.PUT, produces = "text/html")
public String updatepassword(@RequestParam(value = "_proceed", required = false) String proceed,
					 		 @Validated({User.Password.class})  User user, 
					 		 BindingResult bindingResult, 
					 		 Principal principal,
					 		 Model uiModel, 
					 		 HttpServletRequest httpServletRequest) {
	try{
		User loggedInUser = userService.user_findByLogin(principal.getName());
		if(proceed != null){
			if (bindingResult.hasErrors()) {
				user.refreshUserInfo(userService.user_findById(user.getId()));
				return "security/users/pass";
			}
			//check that passwords match
			if (!user.getPassword().equals(user.getConfirmPassword())) {
				user.refreshUserInfo(userService.user_findById(user.getId()));
				bindingResult.rejectValue("confirmPassword", "security_password_reset_confirm_passwords_unmatching");
				return "security/users/pass";
			}
			//check RegEx
			if (!user.getConfirmPassword().matches(globalSettings.getPasswordEnforcementRegex())){
				user.refreshUserInfo(userService.user_findById(user.getId()));
				bindingResult.rejectValue("confirmPassword", globalSettings.getPasswordEnforcementMessage(), this.globalSettings.getPasswordEnforcementMessage());
				return "security/users/pass";
			}
			user.refreshUserInfo(userService.user_findById(user.getId()));
			user = userService.user_updatePassword(user);
			uiModel.asMap().clear();
			return "redirect:/security/users/" + encodeUrlPathSegment(user.getId().toString(), httpServletRequest);
		}
		else{
			if (user.getType().equals(SecurityType.I)){
				return "redirect:/security/users/internal" ;
			}
			if (user.getType().equals(SecurityType.E)){
				return "redirect:/security/users/external" ;	
			}
		}
		return "redirect:/security";
	} catch (Exception e) {
		log.error(e.getMessage(),e);
		throw (new RuntimeException(e));
	}
}
 
Example 18
Source File: AccountController.java    From JDeSurvey with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
	 * Updates logged in user information
	 * @param proceed
	 * @param user
	 * @param bindingResult
	 * @param principal
	 * @param uiModel
	 * @param httpServletRequest
	 * @return
	 */
	@Secured({"ROLE_SURVEY_ADMIN"})
	@RequestMapping(method = RequestMethod.PUT, produces = "text/html")
	public String update(@RequestParam(value = "_proceed", required = false) String proceed,
			@Valid User user, 
			BindingResult bindingResult, 
			Principal principal,
			Model uiModel, 
			HttpServletRequest httpServletRequest) {
		log.info("update(): handles PUT");
		try{
			User loggedInUser = userService.user_findByLogin(principal.getName());
			if(proceed != null){
				if (bindingResult.hasErrors()) {
					uiModel.addAttribute("user", user);
					return "account/update";
				}
				if (userService.user_findByLogin(user.getLogin()) != null && userService.user_ValidateLoginIsUnique(user) == true) {
					bindingResult.rejectValue("login", "field_unique");
					uiModel.addAttribute("user", user);
					return "account/update";
				}
				if (userService.user_findByEmail(user.getEmail()) != null && userService.user_ValidateEmailIsUnique(user) == true){
					bindingResult.rejectValue("email", "field_unique");
					uiModel.addAttribute("user", user);
					return "account/update";
				}
				uiModel.asMap().clear();
				user = userService.user_updateInformation(user);
				return "redirect:/account/show";

			}
			else {
				return "redirect:/account/show";
			}

	} catch (Exception e) {
		log.error(e.getMessage(),e);
		throw (new RuntimeException(e));
	}
}
 
Example 19
Source File: TemplateManageAction.java    From bbs with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * 模板管理 添加
 */
@RequestMapping(params="method=add", method=RequestMethod.POST)
public String add(ModelMap model,Templates formbean,BindingResult result, 
		MultipartHttpServletRequest request, HttpServletResponse response)throws Exception {
	
	//数据校验
	this.validator.validate(formbean, result); 
	
	Templates templates = new Templates();
	templates.setName(formbean.getName().trim());
	templates.setDirName(formbean.getDirName().trim());
	templates.setIntroduction(formbean.getIntroduction());
	
	
	if (!result.hasErrors()) {  
		//图片上传
		List<MultipartFile> files = request.getFiles("uploadImage"); 
		for(MultipartFile file : files) {
			if(!file.isEmpty()){	
				//验证文件类型
				List<String> formatList = new ArrayList<String>();
				formatList.add("gif");
				formatList.add("jpg");
				formatList.add("jpeg");
				formatList.add("bmp");
				formatList.add("png");
				boolean authentication = FileUtil.validateFileSuffix(file.getOriginalFilename(),formatList);
				if(authentication){
					//取得文件后缀		
					String ext = FileUtil.getExtension(file.getOriginalFilename());
					//文件保存目录
					String pathDir = "common"+File.separator+formbean.getDirName()+File.separator;
					//构建文件名称
					String fileName = "templates." + ext;
					templates.setThumbnailSuffix(ext);
					
					//生成文件保存目录
					FileUtil.createFolder(pathDir);
					//保存文件
					localFileManage.writeFile(pathDir, fileName,file.getBytes());
			   }else{
				   result.rejectValue("thumbnailSuffix","errors.required", new String[]{"图片格式错误"},"");
			   }
			}
			
			break;//只有一个文件上传框
		}
	}

	if (result.hasErrors()) {  
		return "jsp/template/add_templates";
	} 
	
	
	
	List<Layout> layoutList = templateManage.newTemplate(templates.getDirName());
	templateService.saveTemplate(templates,layoutList);
	
	model.addAttribute("message","添加模板成功");//返回消息
	model.addAttribute("urladdress", RedirectPath.readUrl("control.template.list"));//返回消息//返回转向地址
	return "jsp/common/message";
}
 
Example 20
Source File: QuestionRowLabelController.java    From JDeSurvey with GNU Affero General Public License v3.0 4 votes vote down vote up
@Secured({"ROLE_ADMIN","ROLE_SURVEY_ADMIN"})
@RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String createPost(Question question, 
						 BindingResult bindingResult,
						 @RequestParam(value="_proceed", required = false) String proceed,
						 Principal principal,	
						 Model uiModel, 
						 HttpServletRequest httpServletRequest) {
	log.info("create(): handles " + RequestMethod.POST.toString());
	try {
		
		String login = principal.getName();
		User user = userService.user_findByLogin(login);
		//Check if the user is authorized
		if(!securityService.userIsAuthorizedToManageSurvey(surveySettingsService.question_findById(question.getId()).getPage().getSurveyDefinition().getId(), user) &&
		   !securityService.userBelongsToDepartment(surveySettingsService.question_findById(question.getId()).getPage().getSurveyDefinition().getDepartment().getId(), user)	) {
			log.warn("Unauthorized access to url path " + httpServletRequest.getPathInfo() + " attempted by user login:" + principal.getName() + "from IP:" + httpServletRequest.getLocalAddr());
			return "accessDenied";	
		}
		
		if(proceed != null){
			boolean isValid=true;
			for (int i = 0; i<question.getRowLabelsList().size(); i ++) {
				if (question.getRowLabelsList().get(i).getLabel() != null	&&	question.getRowLabelsList().get(i).getLabel().trim().length() > 0){
						
					if (question.getRowLabelsList().get(i).getLabel().trim().length() ==0	||
							question.getRowLabelsList().get(i).getLabel().trim().length() > 75 ){
						bindingResult.rejectValue("rowLabelsList["+ i +"].label", "invalidEntry");
						isValid= false;
						
					} 
				}
				else{
					//User is trying to save an empty MC form
					if (i==0){
						bindingResult.rejectValue("rowLabelsList["+ i +"].label", "invalidEntry");
						isValid= false;
					}
				}
			}

			if (!isValid){
				return "settings/questionRows/update";	
			}
			else{
				question = surveySettingsService.question_updateRowLabels(question);
				return "settings/questionRows/saved";
					
			}
		}
		else{
			question = surveySettingsService.question_updateRowLabels(question);
			return "redirect:/settings/surveyDefinitions/" + encodeUrlPathSegment(question.getPage().getSurveyDefinition().getId().toString(), httpServletRequest);
		}
		

	} catch (Exception e) {
		log.error(e.getMessage(),e);
		throw (new RuntimeException(e));
	}

}