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

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

Introduction

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

Prototype

public ModelAndView(View view) 

Source Link

Document

Convenient constructor when there is no model data to expose.

Usage

From source file:cn.cuizuoli.gotour.controller.AdminController.java

@RequestMapping("")
public ModelAndView index() {
    return new ModelAndView("admin/index");
}

From source file:edu.pitt.sis.infsci2730.finalProject.web.shoppingBagController.java

@RequestMapping(value = "", method = RequestMethod.GET)
public ModelAndView mypage(HttpSession session) {
    try {//w ww  .java2s  .  com
        CustomerDBModel customer = (CustomerDBModel) session.getAttribute("customer");
        if (customer == null) {
            return new ModelAndView("index");
        } else {
            return new ModelAndView("shoppingBag", "customer", customer);
        }
    } catch (Exception ex) {
        Logger.getLogger(OrderHistoryController.class.getName()).log(Level.SEVERE, null, ex);
        return new ModelAndView("500");
    }
}

From source file:de.dentrassi.osgiee.web5.WelcomeController.java

@RequestMapping("/")
public ModelAndView main() {
    final BookService bs = Activator.getBookService();
    if (bs == null) {
        return new ModelAndView("redirect:/setup");
    } else {//  w  ww . ja  va  2s.  co  m
        final Map<String, Object> model = new HashMap<>();
        model.put("books", bs.listAll());
        return new ModelAndView("index", model);
    }
}

From source file:com.amkaawaken.controllers.SponsorController.java

@RequestMapping(value = "/sponsors_info.htm", method = RequestMethod.GET)
public ModelAndView sponsors_info() {
    return new ModelAndView("com.amkaawaken.sponsors_info");
}

From source file:controllers.NotificationController.java

@RequestMapping(value = "notification", method = RequestMethod.GET)
public ModelAndView notification(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView model = new ModelAndView("page");
    model.addObject("content", "notification");
    return model;
}

From source file:com.util.MyController.java

@RequestMapping(value = "/myPage1.htm")
public ModelAndView myMethod1(Model model) {
    model.addAttribute("name", "XYZ");

    return new ModelAndView("page1");
}

From source file:com.amkaawaken.controllers.SigninController.java

@RequestMapping(value = "/signout.htm", method = RequestMethod.GET)
public ModelAndView signout() {

    //this.getRequest().getSession().invalidate();
    return new ModelAndView("redirect:/sponsors_profile.htm");
}

From source file:com.sab2i.sabweb.controller.ComplexMathController.java

@RequestMapping(path = "/welcome.do", method = RequestMethod.GET)
public ModelAndView hello() {
    String message = String.valueOf(calculator.doComplexMath(10, 5));
    ModelAndView modelAndView = new ModelAndView("welcome");
    modelAndView.addObject("message", message);
    return modelAndView;
}

From source file:com.mascova.caliga.controller.LoginController.java

@RequestMapping(method = RequestMethod.GET)
public ModelAndView root() {
    return new ModelAndView("login");
}

From source file:ash.resourcemanager.spring.controllers.IndexController.java

@RequestMapping(value = "/index.htm", method = RequestMethod.GET)
public ModelAndView showHomePage() {
    ModelAndView modelAndView = new ModelAndView("index");
    GenericDAO<Project> projectsDAO = new GenericDAO<Project>(Project.class);
    GenericDAO<Assignment> assignmentsDAO = new GenericDAO<Assignment>(Assignment.class);
    GenericDAO<Employee> employeeDAO = new GenericDAO<Employee>(Employee.class);

    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    String date = sdf.format(cal.getTime());

    modelAndView.addObject("date", date);
    modelAndView.addObject("projects", projectsDAO.getAll());
    modelAndView.addObject("employees", employeeDAO.getAll());

    return modelAndView;
}