com.portal.controller.WelcomeController.java Source code

Java tutorial

Introduction

Here is the source code for com.portal.controller.WelcomeController.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 com.portal.controller;

import com.portal.service.PortalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 *
 * @author Evgen
 */
@Controller
public class WelcomeController {

    PortalService portalService;

    public PortalService getPortalService() {
        return portalService;
    }

    @Autowired
    public void setPortalService(PortalService portalService) {
        this.portalService = portalService;
    }

    @RequestMapping("/")
    public String showIndexPage(ModelMap model) {
        model.addAttribute("employes", portalService.getAllEmployes());
        return "index";
    }

    @RequestMapping("/404")
    public String show404Page() {
        return "404";
    }

    @RequestMapping("/403")
    public String show403Page() {
        return "403";
    }

    @RequestMapping("/login")
    public String showLoginPage() {
        return "login";
    }
}