List of usage examples for org.springframework.ui Model containsAttribute
boolean containsAttribute(String attributeName);
From source file:org.jbb.members.web.base.controller.UcpEditAccountController.java
@RequestMapping(method = RequestMethod.GET) public String editAccount(Model model, Authentication authentication, @ModelAttribute(EDIT_ACCOUNT_FORM) EditAccountForm form) { Member member = getCurrentMember(authentication); fillFieldWithUsername(form, member); if (!model.containsAttribute(FORM_SAVED_FLAG)) { form.setEmail(member.getEmail().toString()); model.addAttribute(EDIT_ACCOUNT_FORM, form); }/* w ww .j ava2 s . co m*/ model.addAttribute(EMAIL_FIELD_ENABLED, permissionService.checkPermission(CAN_CHANGE_EMAIL)); return VIEW_NAME; }
From source file:org.vinmonopolet.storefront.controllers.pages.CheckoutController.java
protected String processOrderCode(final String orderCode, final Model model, final HttpServletRequest request) throws CMSItemNotFoundException { final OrderData orderDetails = orderFacade.getOrderDetailsForCode(orderCode); if (orderDetails.isGuestCustomer() && !StringUtils.substringBefore(orderDetails.getUser().getUid(), "|") .equals(getSessionService().getAttribute(WebConstants.ANONYMOUS_CHECKOUT_GUID))) { return getCheckoutRedirectUrl(); }/*w w w. j av a2s . com*/ if (orderDetails.getEntries() != null && !orderDetails.getEntries().isEmpty()) { for (final OrderEntryData entry : orderDetails.getEntries()) { final String productCode = entry.getProduct().getCode(); final ProductData product = productFacade.getProductForCodeAndOptions(productCode, Arrays.asList(ProductOption.BASIC, ProductOption.PRICE, ProductOption.CATEGORIES)); entry.setProduct(product); } } model.addAttribute("orderCode", orderCode); model.addAttribute("orderData", orderDetails); model.addAttribute("allItems", orderDetails.getEntries()); model.addAttribute("deliveryAddress", orderDetails.getDeliveryAddress()); model.addAttribute("deliveryMode", orderDetails.getDeliveryMode()); model.addAttribute("paymentInfo", orderDetails.getPaymentInfo()); model.addAttribute("pageType", PageType.ORDERCONFIRMATION.name()); final String uid = orderDetails.getPaymentInfo().getBillingAddress().getEmail(); model.addAttribute("email", uid); if (orderDetails.isGuestCustomer() && !model.containsAttribute("guestRegisterForm")) { final GuestRegisterForm guestRegisterForm = new GuestRegisterForm(); guestRegisterForm.setOrderCode(orderDetails.getGuid()); guestRegisterForm.setUid(uid); model.addAttribute(guestRegisterForm); } final AbstractPageModel cmsPage = getContentPageForLabelOrId(CHECKOUT_ORDER_CONFIRMATION_CMS_PAGE_LABEL); storeCmsPageInModel(model, cmsPage); setUpMetaDataForContentPage(model, getContentPageForLabelOrId(CHECKOUT_ORDER_CONFIRMATION_CMS_PAGE_LABEL)); model.addAttribute("metaRobots", "no-index,no-follow"); return ControllerConstants.Views.Pages.Checkout.CheckoutConfirmationPage; }
From source file:sg.ncl.MainController.java
@RequestMapping(value = "/admin/gpus", method = RequestMethod.GET) public String adminGpuManagement(Model model, HttpSession session) { if (!validateIfAdmin(session)) { return NO_PERMISSION_PAGE; }//from w w w . j a va2 s.c o m if (!model.containsAttribute("gpuUserForm")) { model.addAttribute("gpuUserForm", new GpuUserForm()); model.addAttribute("toggleModal", "hide"); } model.addAttribute("domains", gpuProperties.getDomains()); return "gpu_dashboard"; }
From source file:sg.ncl.MainController.java
@GetMapping("/admin/statistics") public String adminUsageStatistics(HttpSession session, Model model) { if (!validateIfAdmin(session)) { return NO_PERMISSION_PAGE; }//from w w w.j a v a 2 s .com if (!model.containsAttribute(KEY_QUERY)) { model.addAttribute(KEY_QUERY, new ProjectUsageQuery()); model.addAttribute("newProjects", new ArrayList<ProjectDetails>()); model.addAttribute("activeProjects", new ArrayList<ProjectDetails>()); model.addAttribute("inactiveProjects", new ArrayList<ProjectDetails>()); model.addAttribute("stoppedProjects", new ArrayList<ProjectDetails>()); model.addAttribute("utilization", new HashMap<String, MonthlyUtilization>()); model.addAttribute("statsCategory", new HashMap<String, Integer>()); model.addAttribute("statsAcademic", new HashMap<String, Integer>()); } return "admin_usage_statistics"; }
From source file:sg.ncl.MainController.java
/** * A page to show new users has successfully registered to apply to join an existing team * The page contains the team owner information which the users requested to join * * @param model The model which is passed from signup * @return A success page otherwise an error page if the user tries to access this page directly *//*from w w w .j a v a 2 s . c o m*/ @RequestMapping("/join_application_submitted") public String joinTeamAppSubmit(Model model) { // model attribute should be passed from /signup2 // team is required to display the team owner details if (model.containsAttribute("team")) { return "join_team_application_submitted"; } return "error"; }
From source file:sourcebossyear.controller.EstudianteController.java
@RequestMapping(method = RequestMethod.GET) public String listarAction(Model model) { List<Estudiante> estudiantes = this.estudianteServicio.getAll(); model.addAttribute("estudiantes", estudiantes); if (!model.containsAttribute("isDatosActualizados")) { model.addAttribute("isDatosActualizados", false); }// ww w . ja va 2 s. c o m return "estudiante/listarEstudiante"; }
From source file:sourcebossyear.controller.GrupoController.java
@RequestMapping(method = RequestMethod.GET) public String listarAction(Model model) { List<Grupo> grupos = this.grupoServicio.getAll(); model.addAttribute("grupos", grupos); if (!model.containsAttribute("isDatosActualizados")) { model.addAttribute("isDatosActualizados", false); }//from ww w . ja v a2 s. c o m return "estudiante/listarGrupo"; }