Example usage for org.springframework.ui Model addAttribute

List of usage examples for org.springframework.ui Model addAttribute

Introduction

In this page you can find the example usage for org.springframework.ui Model addAttribute.

Prototype

Model addAttribute(String attributeName, @Nullable Object attributeValue);

Source Link

Document

Add the supplied attribute under the supplied name.

Usage

From source file:applikaasie.domein.artikel.ArtikelController.java

@RequestMapping(value = "/nieuwArtikel")
public String newArtikel(Model model) {
    model.addAttribute("artikel", new Artikel());
    return "artikel/newAndEdit";
}

From source file:ch.javaee.basicMvc.web.controller.AccessController.java

@RequestMapping("/login/error")
public String loginError(Model model) {
    model.addAttribute("loginError", true);
    return "view/public/login";
}

From source file:com.epam.ipodromproject.controller.MakeABetControllec.java

@RequestMapping(value = "getCompetitionsToMakeABetPage", method = RequestMethod.GET)
public String getCompetitionsToMakeByPage(@RequestParam("page") Integer page,
        @RequestParam("resultsPerPage") Integer resultsPerPage, Model model) {
    model.addAttribute("competitions",
            competitionService.getCompetitionsToMakeABetAfterDate(new Date(), page, resultsPerPage));
    model.addAttribute("types", BetType.values());
    model.addAttribute("firstNumber", (page - 1) * resultsPerPage);
    return "lists/competitionsToMakeABetDropList";
}

From source file:com.karki.spring.controller.BatchController.java

@RequestMapping(value = "/editBatch", method = RequestMethod.GET)
public String editPage(Model model, @ModelAttribute Batch batch) {
    model.addAttribute("hello", "hii");
    return "batch/EditBatch";
}

From source file:com.springinpractice.ch14.kite.sample.web.HomeController.java

private void loadMotd(Model model) {
    try {//www . j  ava  2  s.  c  o  m
        model.addAttribute("motd", messageService.getMotd());
    } catch (Exception e) {
        log.error("Unable to load MOTD");
    }
}

From source file:com.springinpractice.ch14.kite.sample.web.HomeController.java

private void loadImportantMessages(Model model) {
    try {// w w w.  ja  v a  2  s.  co  m
        model.addAttribute("importantMessages", messageService.getImportantMessages());
    } catch (Exception e) {
        log.error("Unable to load important messages");
    }
}

From source file:de.inovex.liferay.tipsandtricks.actiontest.WhitelistTestController.java

@RequestMapping(params = "update=success")
public String view(final RenderRequest request, final Model model) {
    model.addAttribute("sessionTimestamp", System.currentTimeMillis());
    model.addAttribute("updatedValue", "NewValue:" + request.getPortletSession().getAttribute(SESSION_KEY));
    return UPDATE_VIEW;
}

From source file:io.spring.isomorphic.CommentController.java

@RequestMapping("/")
String render(Model model) {
    model.addAttribute("title", "Layout example");
    model.addAttribute("comments", this.commentRepository.findAll());
    return "index";
}

From source file:com.as.sagma.ControladorVistas.java

/**Se declara para poder utilizarlo en cualquiera de los RequestMapping ESTE ES LA CONEXION CON EL MODEL (ServicioCuentas) **/

@RequestMapping(value = "/nominas") /**este RequestMapping crea una especie de pagina que va a ocultar la extencion**/
public String accesoANominas(Model model) { /** este metodo nunca se utiliza **/
    model.addAttribute("cualquiernombre", cuenta
            .crearCuenta()); /**toma el valor declarado anteriormente del Autowired y lo nombramos como cuenta**/
    return "algodon"; /**Retorna el archivo algodon.jsp**/
}

From source file:com.consol.citrus.demo.voting.web.VotingController.java

@RequestMapping(method = RequestMethod.GET)
public String list(Model model) {
    model.addAttribute("votings", votingService.getVotings());
    return "voting";
}