Example usage for org.springframework.web.servlet ModelAndView addObject

List of usage examples for org.springframework.web.servlet ModelAndView addObject

Introduction

In this page you can find the example usage for org.springframework.web.servlet ModelAndView addObject.

Prototype

public ModelAndView addObject(String attributeName, @Nullable Object attributeValue) 

Source Link

Document

Add an attribute to the model.

Usage

From source file:com.ut.healthelink.controller.productSuiteController.java

/**
 * The '/doc-u-link' request will display the DOC-u-Link information page.
 */// w w  w  . j  a v  a2s.  c o m
@RequestMapping(value = "/doc-u-link", method = RequestMethod.GET)
public ModelAndView doculink() throws Exception {

    ModelAndView mav = new ModelAndView();
    mav.setViewName("/doculink");
    mav.addObject("pageTitle", "DOC-u-Link");
    return mav;
}

From source file:de.interseroh.report.controller.ConfigSetter.java

public void setBranding(ModelAndView modelAndView) {
    String brandingText = env.getProperty("text.branding", "Report Cockpit");
    modelAndView.addObject("brandingText", brandingText);
    String brandingLogo = env.getProperty("logo.branding", "birt-logo.png");
    modelAndView.addObject("brandingLogo", brandingLogo);
}

From source file:org.extremesite.controller.PresidentsController.java

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    ModelAndView mv = new ModelAndView(successView);
    Collection presidents = presidentsDao.getPresidents();
    mv.addObject("presidents", presidents);
    return mv;//from   w w w  .  jav a2 s . c o m
}

From source file:br.com.joaops.smt.controller.SystemDatabaseController.java

@RequestMapping(method = RequestMethod.GET)
public ModelAndView index(HttpServletRequest request, HttpServletResponse response, Pageable p) {
    ModelAndView mav = new ModelAndView("/system/database/index");
    mav.addObject("page", systemDatabaseService.searchAllSystemDatabase(p));
    return mav;/*from  w  w w .j  a  va2  s  .  c o m*/
}

From source file:br.vschettino.forum.controller.SiteController.java

@RequestMapping(value = "/")
public ModelAndView home() {

    List<Discussao> listDiscussao = discussaoDAO.list();
    Long countDiscussoes = discussaoDAO.getCount();
    Long countDiscussoesNaoRespondidas = discussaoDAO.getCountNaoRespondidas();
    Long countRespostas = respostaDAO.getCount();
    ModelAndView model = new ModelAndView("home");
    model.addObject("listDiscussao", listDiscussao);
    model.addObject("countDiscussoes", countDiscussoes);
    model.addObject("countDiscussoesNaoRespondidas", countDiscussoesNaoRespondidas);
    model.addObject("countRespostas", countRespostas);
    return model;
}

From source file:com.springcome.exam.ExamController.java

@RequestMapping(method = RequestMethod.GET, value = "/pk")
public ModelAndView selectExamPk(String id) {
    logger.info("### " + id);
    Stock stock = service.selectStockPk(Long.parseLong(id));

    logger.info("### " + stock.getStockName() + " : " + stock.getStockCode());

    ModelAndView mv = new ModelAndView("exam/exam");

    mv.addObject("stock", stock);

    return mv;/*  ww w . j a  va2  s . c om*/
}

From source file:edu.wisc.doit.tcrypt.controller.CreateController.java

@ExceptionHandler(ServiceErrorException.class)
public ModelAndView handleException(ServiceErrorException e) throws Exception {
    ModelAndView mav = createServiceKeyInit();

    mav.addObject("errorMessage", e.getMessage());
    mav.addObject("zero", e.getServiceName());

    return mav;//from  w ww .j a  va  2s .  co m
}

From source file:net.mindengine.oculus.frontend.web.controllers.admin.user.UserCreateController.java

@Override
protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command,
        BindException errors) throws Exception {
    User user = (User) command;// w w  w . ja  v a 2 s .  c  o  m
    if (user.getPassword() == null)
        user.setPassword("");
    userDAO.createUser(user);

    String msg = "";
    msg += "Your account is:\n";
    msg += "Login: " + user.getLogin() + "\n";
    msg += "Password: " + user.getPassword();

    boolean isMailSent = true;
    String mailExceptionMessage = "";
    try {
        MailUtils.postMail(config.getMailSmtpHost(), config.getMailSmtpPort(), new String[] { user.getEmail() },
                "Oculus Password Recovery", msg, config.getMailSenderName());
    } catch (Exception e) {
        e.printStackTrace();
        isMailSent = false;
        mailExceptionMessage = e.getMessage();
    }

    ModelAndView mav = new ModelAndView(getSuccessView());
    mav.addObject("createdUser", user);
    mav.addObject("isMailSent", isMailSent);
    mav.addObject("mailExceptionMessage", mailExceptionMessage);
    return mav;
}

From source file:protocolo.controller.LoginController.java

@RequestMapping(value = "/loginForm")
ModelAndView loginForm() {//from   w w  w  .  j  ava2 s.c  om
    ModelAndView modelAndView = new ModelAndView("login");
    modelAndView.addObject("login", new Login());
    SimpleDateFormat date = new SimpleDateFormat("dd/MM/yyyy");
    modelAndView.addObject("data", date.format(new Date()));
    return modelAndView;
}

From source file:br.com.arduinoweb.controller.ArduinoController.java

@RequestMapping("/OutputArduino")
public ModelAndView OutputArduino(HttpSession session) {
    ModelAndView mv = new ModelAndView("Admin/OutputArduino");
    mv.addObject("listOutput", new OutputService().getOutputs());
    mv.addObject("listCommand", new CommandService().getCommands());
    mv.addObject("listStatus", new StatusService().getStatus());
    return mv;//from ww w. ja  v a 2  s .  c  o m
}