org.neposoft.reservation.controllers.PagesController.java Source code

Java tutorial

Introduction

Here is the source code for org.neposoft.reservation.controllers.PagesController.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.neposoft.reservation.controllers;

import domain.AppFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author mrdezzods
 */
@Controller
public class PagesController {

    @Autowired
    private AppFacade facade;

    @RequestMapping(value = "/")
    public ModelAndView homepage() {
        ModelAndView mv = new ModelAndView("homepage");
        mv.addObject("popularRestaurants", facade.getAllRestaurants());
        return mv;
    }

    @RequestMapping(value = "/contact")
    public String contact() {
        return "contact";
    }
}