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

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

Introduction

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

Prototype

public void setViewName(@Nullable String viewName) 

Source Link

Document

Set a view name for this ModelAndView, to be resolved by the DispatcherServlet via a ViewResolver.

Usage

From source file:org.sventon.web.ctrl.ConfigurationFormController.java

@RequestMapping(method = GET)
public ModelAndView setUpForm(ModelAndView modelAndView) throws Exception {
    modelAndView.getModel().put("addedRepositories", application.getRepositoryNames());
    modelAndView.getModel().put("command", new ConfigCommand());
    modelAndView.setViewName("config/configForm");
    return modelAndView;
}

From source file:com.github.fedorchuck.webstore.web.controllers.GoodsController.java

@RequestMapping(value = "add", method = GET)
public ModelAndView showGoodsForm(ModelAndView model) {
    model.addObject(new Commodity());
    model.addObject("userActions", new UserActions());
    model.addObject("radioItems", RADIO_ITEMS);
    model.setViewName("goodsForm");
    return model;
}

From source file:com.fengduo.bee.web.controller.product.ItemEditController.java

/**
 * /*from  ww w  .  j  a v a  2s.c  om*/
 * 
 * @return
 */
@RequestMapping(value = "/{id}/edit", method = RequestMethod.GET)
public ModelAndView edit(@PathVariable("id") Long id, ModelAndView mav) {
    mav.setViewName("item/add");
    // ?id?
    if (Argument.isNotPositive(id)) {
        mav.addObject("errMsg", "?id?,!");
        return mav;
    }
    // ?id???
    Item item = itemService.getItemById(id);
    if (item == null) {
        mav.addObject("errMsg", "?id?,!");
        return mav;
    }
    // ???
    if (!NumberParser.isEqual(getCurrentUserId(), item.getUserId())) {
        mav.addObject("errMsg", "?id?,!");
        mav.setViewName("error/404");
        return mav;
    }
    mav.addObject("itemId", id);
    mav.addObject("item", item);
    mav.addObject("postUrl", "/item/edit");
    return mav;
}

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

/**
 * The "" method will return the list of hl7 versions saved in the system.
 * @return/* w w w.  j  a v a 2s  .c o m*/
 * @throws Exception 
 */
@RequestMapping(value = "", method = RequestMethod.GET)
public ModelAndView listHL7Versions() throws Exception {

    ModelAndView mav = new ModelAndView();
    mav.setViewName("/administrator/sysadmin/hl7");

    //Return a list of available macros
    List<mainHL7Details> hl7Versions = sysAdminManager.getHL7List();
    mav.addObject("hl7Versions", hl7Versions);

    return mav;
}

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

/**
 * The "/create" method will return the blank form to create a new HL7 version
 * @return/* www.  j av a2 s. co  m*/
 * @throws Exception 
 */
@RequestMapping(value = "/create", method = RequestMethod.GET)
public ModelAndView createHL7Spec() throws Exception {

    ModelAndView mav = new ModelAndView();
    mav.setViewName("/administrator/sysadmin/hl7/create");

    //Return a list of available macros
    mainHL7Details hl7Spec = new mainHL7Details();
    mav.addObject("HL7Details", hl7Spec);

    return mav;
}

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

private void showParameterForm(@PathVariable("reportName") String reportName,
        @ModelAttribute("parameterForm") ParameterForm form, ModelAndView modelAndView) {
    modelAndView.setViewName("/parameters");
    configSetter.setBranding(modelAndView);
    configSetter.setVersion(modelAndView);
    modelAndView.addObject("parameterForm", form);
    injectReportUri(form, modelAndView, reportName);
}

From source file:br.com.semanticwot.cd.controllers.GatewayController.java

@ExceptionHandler({ GatewayWotNotCreated.class })
public ModelAndView handleError(HttpServletRequest req, Exception exception) {
    LOGGER.log(Level.WARNING, "Request: {0} raised {1}", new Object[] { req.getRequestURL(), exception });

    ModelAndView mav = new ModelAndView();
    mav.addObject("info", exception.getMessage());
    mav.addObject("gateway", new GatewayForm());
    mav.addObject("url", req.getRequestURL());
    mav.setViewName("gateway/form");
    return mav;// w  w  w . j  av a2 s  .  c o  m
}

From source file:me.bulat.jivr.webmin.web.root.AppRootController.java

@RequestMapping(value = { "/" }, method = { RequestMethod.GET })
public ModelAndView welcomePage() {
    ModelAndView model = new ModelAndView();
    model.addObject("title", "Spring Security Tutorial");
    model.addObject("message", "Welcome Page !");
    model.setViewName("/welcome");
    return model;
}

From source file:me.bulat.jivr.webmin.web.root.AppRootController.java

@RequestMapping(value = { "/login" }, method = { RequestMethod.GET })
public ModelAndView loginPage() {
    ModelAndView model = new ModelAndView();
    model.addObject("title", "Jivr Web Console Login page");
    model.addObject("message", "Login Page!");
    model.setViewName("form/login");
    return model;
}

From source file:com.klm.workshop.controller.host.manage.WorkshopController.java

/**
 * Show update workshop form/* ww  w. j a  va  2s . c  o m*/
 * 
 * @param id The ID of the workshop to update
 * @param model Objects and view
 * @return Form to update a workshop
 */
@RequestMapping(value = "/workshops/update/{id}", method = RequestMethod.GET)
public ModelAndView getUpdate(ModelAndView model, @PathVariable int id) {
    model.addObject("workshop", (Workshop) workshopDAO.findById(id));
    model.setViewName("host/manage/workshops/update");
    return model;
}