Java Code Examples for org.springframework.ui.ModelMap#clear()
The following examples show how to use
org.springframework.ui.ModelMap#clear() .
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: MainController.java From sakai with Educational Community License v2.0 | 6 votes |
@RequestMapping(value = "/edit", params={"save"}, method = RequestMethod.POST) public String processSaveEdit(final MessageEntity messageEntity, final BindingResult bindingResult, final ModelMap model) { if (bindingResult.hasErrors()) { return "modified"; } log.debug("processSaveEdit(): MessageEntity = " + messageEntity); MessageBundleProperty property = messageBundleService.getMessageBundleProperty(messageEntity.getId()); property.setValue(messageEntity.getValue()); if (securityService.isSuperUser()) { messageBundleService.updateMessageBundleProperty(property); } else { throw new SecurityException("Only an admin type user is allowed to update message bundle properties"); } model.clear(); return "redirect:/modified"; }
Example 2
Source File: MainController.java From sakai with Educational Community License v2.0 | 6 votes |
@RequestMapping(value = "/edit", params={"save"}, method = RequestMethod.POST) public String processSaveEdit(final MessageEntity messageEntity, final BindingResult bindingResult, final ModelMap model) { if (bindingResult.hasErrors()) { return "modified"; } log.debug("processSaveEdit(): MessageEntity = " + messageEntity); MessageBundleProperty property = messageBundleService.getMessageBundleProperty(messageEntity.getId()); property.setValue(messageEntity.getValue()); if (securityService.isSuperUser()) { messageBundleService.updateMessageBundleProperty(property); } else { throw new SecurityException("Only an admin type user is allowed to update message bundle properties"); } model.clear(); return "redirect:/modified"; }
Example 3
Source File: UserController.java From attic-rave with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/admin/userdetail/update", method = RequestMethod.POST) public String updateUserDetail(@ModelAttribute User user, BindingResult result, @ModelAttribute(ModelKeys.TOKENCHECK) String sessionToken, @RequestParam() String token, @RequestParam(required = false) String referringPageId, ModelMap modelMap, SessionStatus status) { checkTokens(sessionToken, token, status); user.setConfirmPassword(user.getPassword()); userProfileValidator.validate(user, result); if (result.hasErrors()) { modelMap.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId); AdminControllerUtil.addNavigationMenusToModel(SELECTED_ITEM, (Model) modelMap, referringPageId); return ViewNames.ADMIN_USERDETAIL; } userService.updateUserProfile(user); modelMap.clear(); status.setComplete(); return "redirect:/app/admin/users?action=update&referringPageId=" + referringPageId; }
Example 4
Source File: UserController.java From attic-rave with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/admin/userdetail/delete", method = RequestMethod.POST) public String deleteUserDetail(@ModelAttribute User user, @ModelAttribute(ModelKeys.TOKENCHECK) String sessionToken, @RequestParam String token, @RequestParam(required = false) String confirmdelete, @RequestParam(required = false) String referringPageId, ModelMap modelMap, SessionStatus status) { checkTokens(sessionToken, token, status); if (!Boolean.parseBoolean(confirmdelete)) { modelMap.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId); AdminControllerUtil.addNavigationMenusToModel(SELECTED_ITEM, (Model) modelMap, referringPageId); modelMap.addAttribute("missingConfirm", true); return ViewNames.ADMIN_USERDETAIL; } userService.deleteUser(user.getId()); modelMap.clear(); status.setComplete(); return "redirect:/app/admin/users?action=delete&referringPageId=" + referringPageId; }
Example 5
Source File: WidgetController.java From attic-rave with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/admin/widgetdetail/update", method = RequestMethod.POST) public String updateWidgetDetail(@ModelAttribute(ModelKeys.WIDGET) Widget widget, BindingResult result, @ModelAttribute(ModelKeys.TOKENCHECK) String sessionToken, @RequestParam String token, @RequestParam(required = false) String referringPageId, ModelMap modelMap, SessionStatus status) { checkTokens(sessionToken, token, status); widgetValidator.validate(widget, result); if (result.hasErrors()) { addNavigationMenusToModel(SELECTED_ITEM, (Model) modelMap, referringPageId); modelMap.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId); modelMap.addAttribute(ModelKeys.CATEGORIES, categoryService.getAllList()); return ViewNames.ADMIN_WIDGETDETAIL; } widgetService.updateWidget(widget); modelMap.clear(); status.setComplete(); return "redirect:/app/admin/widgets?action=update&referringPageId=" + referringPageId; }
Example 6
Source File: PortalPreferenceController.java From attic-rave with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/admin/preferencedetail/update", method = RequestMethod.POST) public String updatePreferences(@ModelAttribute("preferenceForm") PortalPreferenceForm form, BindingResult result, @ModelAttribute(ModelKeys.TOKENCHECK) String sessionToken, @RequestParam String token, @RequestParam(required = false) String referringPageId, ModelMap modelMap, SessionStatus status) { checkTokens(sessionToken, token, status); formValidator.validate(form, result); if (result.hasErrors()) { modelMap.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId); addNavigationMenusToModel(SELECTED_ITEM, (Model) modelMap, referringPageId); return ViewNames.ADMIN_PREFERENCE_DETAIL; } final Set<Map.Entry<String, PortalPreference>> entries = form.getPreferenceMap().entrySet(); for (Map.Entry<String, PortalPreference> entry : entries) { preferenceService.savePreference(entry.getValue()); } modelMap.clear(); status.setComplete(); return "redirect:/app/admin/preferences?action=update&referringPageId=" + referringPageId; }
Example 7
Source File: TodoController.java From Mastering-Spring-5.1 with MIT License | 5 votes |
@RequestMapping(value = "/add-todo", method = RequestMethod.POST) public String addTodo(ModelMap model, @Valid Todo todo, BindingResult result) { if (result.hasErrors()) { return "todo"; } service.addTodo(retrieveLoggedinUserName(), todo.getDesc(), new Date(), false); model.clear(); return "redirect:list-todos"; }
Example 8
Source File: TodoController.java From Mastering-Spring-5.0 with MIT License | 5 votes |
@RequestMapping(value = "/add-todo", method = RequestMethod.POST) public String addTodo(ModelMap model, @Valid Todo todo, BindingResult result) { if (result.hasErrors()) { return "todo"; } service.addTodo(retrieveLoggedinUserName(), todo.getDesc(), new Date(), false); model.clear(); return "redirect:list-todos"; }
Example 9
Source File: TodoController.java From SpringMvcStepByStep with MIT License | 5 votes |
@RequestMapping(value = "/add-todo", method = RequestMethod.POST) public String addTodo(ModelMap model, @Valid Todo todo, BindingResult result) { if (result.hasErrors()) { return "todo"; } service.addTodo(retrieveLoggedinUserName(), todo.getDesc(), new Date(), false); model.clear(); return "redirect:list-todos"; }
Example 10
Source File: MainController.java From sakai with Educational Community License v2.0 | 5 votes |
@RequestMapping(value = "/edit", params={"revert"}, method = RequestMethod.POST) public String processRevertEdit(final MessageEntity messageEntity, final BindingResult bindingResult, final ModelMap model) { if (bindingResult.hasErrors()) { return "modified"; } log.debug("processRevertEdit(): MessageEntity = " + messageEntity); MessageBundleProperty property = messageBundleService.getMessageBundleProperty(messageEntity.getId()); if (securityService.isSuperUser()) { messageBundleService.revert(property); } else { throw new SecurityException("Only an admin type user is allowed to revert message bundle properties"); } model.clear(); return "redirect:/modified"; }
Example 11
Source File: TodoController.java From SpringMvcStepByStep with MIT License | 5 votes |
@RequestMapping(value = "/add-todo", method = RequestMethod.POST) public String addTodo(ModelMap model, @Valid Todo todo, BindingResult result) { if (result.hasErrors()) { return "todo"; } service.addTodo(retrieveLoggedinUserName(), todo.getDesc(), new Date(), false); model.clear(); return "redirect:list-todos"; }
Example 12
Source File: MainController.java From sakai with Educational Community License v2.0 | 5 votes |
@RequestMapping(value = "/edit", params={"revert"}, method = RequestMethod.POST) public String processRevertEdit(final MessageEntity messageEntity, final BindingResult bindingResult, final ModelMap model) { if (bindingResult.hasErrors()) { return "modified"; } log.debug("processRevertEdit(): MessageEntity = " + messageEntity); MessageBundleProperty property = messageBundleService.getMessageBundleProperty(messageEntity.getId()); if (securityService.isSuperUser()) { messageBundleService.revert(property); } else { throw new SecurityException("Only an admin type user is allowed to revert message bundle properties"); } model.clear(); return "redirect:/modified"; }
Example 13
Source File: TodoController.java From Mastering-Spring-5.1 with MIT License | 4 votes |
@RequestMapping(value = "/delete-todo", method = RequestMethod.GET) public String deleteTodo(ModelMap model, @RequestParam int id) { service.deleteTodo(id); model.clear(); return "redirect:list-todos"; }
Example 14
Source File: TodoController.java From Mastering-Spring-5.0 with MIT License | 4 votes |
@RequestMapping(value = "/delete-todo", method = RequestMethod.GET) public String deleteTodo(ModelMap model, @RequestParam int id) { service.deleteTodo(id); model.clear(); return "redirect:list-todos"; }
Example 15
Source File: TodoController.java From SpringMvcStepByStep with MIT License | 4 votes |
@RequestMapping(value = "/delete-todo", method = RequestMethod.GET) public String deleteTodo(ModelMap model, @RequestParam int id) { service.deleteTodo(id); model.clear(); return "redirect:list-todos"; }
Example 16
Source File: TodoController.java From SpringMvcStepByStep with MIT License | 4 votes |
@RequestMapping(value = "/delete-todo", method = RequestMethod.GET) public String deleteTodo(ModelMap model, @RequestParam int id) { service.deleteTodo(id); model.clear(); return "redirect:list-todos"; }