List of usage examples for org.springframework.ui Model containsAttribute
boolean containsAttribute(String attributeName);
From source file:es.ucm.fdi.dalgs.learningGoal.web.LearningGoalController.java
/** * Methods for adding LearningGoals/*from w w w .j a v a 2 s.co m*/ */ @RequestMapping(value = "/degree/{degreeId}/competence/{competenceId}/learninggoal/add.htm", method = RequestMethod.GET) public String addLearningGoalGET(Model model, @PathVariable("degreeId") Long id) { if (!model.containsAttribute("learningGoal")) model.addAttribute("learningGoal", new LearningGoal()); model.addAttribute("valueButton", "Add"); model.addAttribute("typeform", "form.add"); return "learningGoal/form"; }
From source file:org.jasig.portlet.announcements.controller.AdminTopicController.java
/** * Add topic view controller, creates or fetches the topic for adding or editing * @param topicIdStr//from ww w . j ava 2 s . c o m * @param model * @return * @throws PortletException */ @RequestMapping(params = "action=addTopic") public String showAddTopicForm(@RequestParam(value = "edit", required = false) String topicIdStr, Model model) throws PortletException { if (!model.containsAttribute("topic")) { if (topicIdStr != null && !"".equals(topicIdStr)) { Long topicId = Long.parseLong(topicIdStr); Topic t = announcementService.getTopic(topicId); model.addAttribute("topic", t); if (log.isDebugEnabled()) log.debug("Adding existing topic to model: " + t.toString()); } else { model.addAttribute("topic", new Topic()); if (log.isDebugEnabled()) log.debug("Adding new topic to model"); } } return "addTopic"; }
From source file:eu.europa.ec.eci.oct.admin.controller.SettingsController.java
/** * Initialises the model by reading the settings. * //from w w w . j av a 2 s . c o m * @param model * @param request * @throws OCTException */ private void initForm(Model model, HttpServletRequest request) throws OCTException { if (!model.containsAttribute("form")) { SettingsBean bean = new SettingsBean(); ConfigurationParameter param = configurationService.getConfigurationParameter(Parameter.LOGO_PATH); bean.setCustomLogo( Parameter.LOGO_PATH.getDefaultValue().equals(param.getValue()) ? null : param.getValue()); param = configurationService.getConfigurationParameter(Parameter.OPTIONAL_VALIDATION); bean.setOptionalValidation(Boolean.valueOf(param.getValue())); param = configurationService.getConfigurationParameter(Parameter.SHOW_DISTRIBUTION_MAP); bean.setDisplayMap(Boolean.valueOf(param.getValue())); param = configurationService.getConfigurationParameter(Parameter.CALLBACK_URL); bean.setCallbackUrl(param.getValue()); model.addAttribute("form", bean); } }
From source file:es.ucm.fdi.dalgs.degree.web.DegreeController.java
@RequestMapping(value = "/degree/add.htm", method = RequestMethod.GET) public String addDegreeGET(Model model) { if (!model.containsAttribute("degree")) model.addAttribute("degree", new Degree()); model.addAttribute("valueButton", "Add"); model.addAttribute("typeform", "form.add"); return "degree/form"; }
From source file:org.ngrinder.operation.ScriptConsoleControllerTest.java
@Test public void runScriptTest() { ScriptConsoleController scriptController = new ScriptConsoleController(); Model model = new ExtendedModelMap(); scriptController.run("", model); assertThat((String) model.asMap().get("result"), nullValue()); String command = "print \'hello\'"; scriptController.run(command, model); assertThat(model.containsAttribute("result"), is(true)); assertThat((String) model.asMap().get("result"), containsString("hello")); scriptController.run("var a = 1", model); scriptController.run("print a", model); assertThat((String) model.asMap().get("result"), containsString("No such property")); }
From source file:es.ucm.fdi.dalgs.topic.web.TopicController.java
@RequestMapping(value = "/degree/{degreeId}/module/{moduleId}/topic/{topicId}/modify.htm", method = RequestMethod.GET) public String modifyTopicGET(@PathVariable("degreeId") Long id_degree, @PathVariable("moduleId") Long id_module, @PathVariable("topicId") Long id_topic, Model model) throws ServletException { if (!model.containsAttribute("topic")) { Topic p = serviceTopic.getTopic(id_topic, id_module, id_degree).getSingleElement(); model.addAttribute("topic", p); }//from w w w .j av a2s. c om model.addAttribute("valueButton", "Modify"); model.addAttribute("typeform", "form.modify"); return "topic/form"; }
From source file:com.exxonmobile.ace.hybris.storefront.controllers.pages.PermissionManagementPageController.java
@RequestMapping(value = "/add", method = RequestMethod.GET) @RequireHardLogIn//from ww w . j ava 2 s .c o m public String getSelectPermissionTypePage(final Model model) throws CMSItemNotFoundException { if (!model.containsAttribute("b2BPermissionTypeSelectionForm")) { model.addAttribute(new B2BPermissionTypeSelectionForm()); } storeCmsPageInModel(model, getContentPageForLabelOrId(ORGANIZATION_MANAGEMENT_CMS_PAGE)); setUpMetaDataForContentPage(model, getContentPageForLabelOrId(ORGANIZATION_MANAGEMENT_CMS_PAGE)); final List<Breadcrumb> breadcrumbs = myCompanyBreadcrumbBuilder.createManagePermissionsBreadcrumb(); breadcrumbs.add(new Breadcrumb("/my-company/organization-management/manage-permissions/add", getMessageSource().getMessage("text.company.managePermissions.create.step1.page", null, getI18nService().getCurrentLocale()), null)); model.addAttribute("breadcrumbs", breadcrumbs); model.addAttribute("metaRobots", "no-index,no-follow"); return ControllerConstants.Views.Pages.MyCompany.MyCompanyManagePermissionTypeSelectPage; }
From source file:it.polimi.diceH2020.launcher.controller.view.MainFlowController.java
@RequestMapping(value = "/launchRetry", method = RequestMethod.GET) public String launch(@RequestParam("cloudType") String cloudType, @RequestParam("useComplexPricingModel") String useComplexPricingModel, @RequestParam("admissionControl") String admissionControl, @RequestParam("message") String message, SessionStatus sessionStatus, Model model) { if (model.containsAttribute("sim_manager")) { sessionStatus.isComplete();/*from w w w . j av a 2s. c o m*/ } List<Scenario> privateScenariosModels = new ArrayList<>(); privateScenariosModels.add(new Scenario(Technology.SPARK, CloudType.valueOf(cloudType), null, true)); privateScenariosModels.add(new Scenario(Technology.SPARK, CloudType.valueOf(cloudType), null, true)); model.addAttribute("scenario", new Scenario(Technology.SPARK, CloudType.valueOf(cloudType), null, Boolean.valueOf(admissionControl))); model.addAttribute("Scenarios", privateScenariosModels); model.addAttribute("message", message); return "fileUpload"; }
From source file:es.ucm.fdi.dalgs.degree.web.DegreeController.java
@RequestMapping(value = "/degree/{degreeId}/modify.htm", method = RequestMethod.GET) public String modifyDegreeGET(@PathVariable("degreeId") Long id, Model model) throws ServletException { if (!model.containsAttribute("degree")) { Degree p = serviceDegree.getDegree(id).getSingleElement(); model.addAttribute("degree", p); }//from w w w .j av a 2 s. c om model.addAttribute("valueButton", "Modify"); model.addAttribute("typeform", "form.modify"); return "degree/form"; }
From source file:es.ucm.fdi.dalgs.module.web.ModuleController.java
/** * methods for adding modules/*from w w w. j av a 2 s.co m*/ */ @RequestMapping(value = "/degree/{degreeId}/module/add.htm", method = RequestMethod.GET) public String addModuleGET(Model model, @PathVariable("degreeId") Long id_degree) { if (!model.containsAttribute("module")) model.addAttribute(new Module()); model.addAttribute("valueButton", "Add"); model.addAttribute("typeform", "form.add"); return "module/form"; }