List of usage examples for org.springframework.ui Model addAttribute
Model addAttribute(String attributeName, @Nullable Object attributeValue);
From source file:com.mobileman.projecth.web.util.KeepScroll.java
public static void save(HttpServletRequest request, Model model) { model.addAttribute(KEEP_SCROLL_KEY, request.getParameter(KEEP_SCROLL_KEY)); }
From source file:de.asgarbayli.rashad.hbd.controllers.definitions.Messages.java
/** * Resets the message to the empty invisible parameters. * * @param model is the Model, whose settings are changed. *//*w ww . j a v a 2 s . co m*/ public static void resetMessage(Model model) { model.addAttribute("display", "none"); model.addAttribute("messageType", ""); model.addAttribute("message", ""); }
From source file:de.asgarbayli.rashad.hbd.controllers.definitions.Messages.java
/** * Sets the message to the visible error mode and shows the passed message. * * @param model is the Model, whose settings are changed. * @param message is the message string that is showed on the view. *//* w ww. jav a2 s . com*/ public static void showErrorMessage(Model model, String message) { System.err.println(message); model.addAttribute("display", "block"); model.addAttribute("messageType", "danger"); model.addAttribute("message", message); }
From source file:de.asgarbayli.rashad.hbd.controllers.definitions.Messages.java
/** * Sets the message to the visible success mode and shows the passed * message./* w w w .j a v a 2 s . c om*/ * * @param model is the Model, whose settings are changed. * @param message is the message string that is showed on the view. */ public static void showSuccessMessage(Model model, String message) { System.out.println(message); model.addAttribute("display", "block"); model.addAttribute("messageType", "success"); model.addAttribute("message", message); }
From source file:com.mobileman.projecth.web.util.ViewState.java
public static void copyViewState(HttpServletRequest request, Model model) { Map<String, String> postValues = new HashMap<String, String>(); model.addAttribute("postValues", postValues); for (@SuppressWarnings("unchecked") Enumeration<String> e = request.getParameterNames(); e.hasMoreElements();) { String name = e.nextElement(); String value = request.getParameter(name); postValues.put(name, value);//from ww w . j a va 2 s. c om //remove later, use only postValues if (!name.startsWith("select") && !name.contains("password")) { model.addAttribute(name, value); } } }
From source file:org.orcid.examples.jopmts.mvc.OrcidProfile.java
public static List<Model> parsePublications(XPath xpath, Node orcidDocument) throws XPathExpressionException { NodeList works = (NodeList) xpath.evaluate("//o:orcid-works/o:orcid-work", orcidDocument, XPathConstants.NODESET); ArrayList<Model> pubList = new ArrayList<Model>(); for (int i = 0; i < works.getLength(); i++) { Node publication = works.item(i); Model pubModel = new OrcidWork(publication, xpath); pubModel.addAttribute("workNum", Integer.toString(i)); pubList.add(pubModel);//from ww w . j a v a2 s . c om } return pubList; }
From source file:com.github.sebhoss.identifier.service.IndexPagesSupplier.java
private static void show(final Model model, final String property) { model.addAttribute(property, Boolean.TRUE); }
From source file:com.brienwheeler.web.spring.web.ModelUtils.java
public static void addAttributeIfNotPresent(Model model, Object attributeValue) { String attributeName = Conventions.getVariableName(attributeValue); if (!model.containsAttribute(attributeName)) model.addAttribute(attributeName, attributeValue); }
From source file:com.mobileman.projecth.web.util.CaptchaUtil.java
static public boolean verify(HttpServletRequest request, Model model, String answer) { Captcha captcha = (Captcha) request.getSession().getAttribute(Captcha.NAME); if (captcha.isCorrect(answer)) { return true; }// w w w .jav a2 s . c o m model.addAttribute(KEY_ERROR, true); return false; }
From source file:org.dhara.portal.web.controllers.GatewayControllerUtil.java
static void addNavigationMenusToModel(String selectedItem, Model model, String referringPageId) { final NavigationMenu topMenu = getTopMenu(referringPageId); model.addAttribute(topMenu.getName(), topMenu); final NavigationMenu tabMenu = getTabMenu(selectedItem, referringPageId); model.addAttribute(tabMenu.getName(), tabMenu); }