source: src/main/java/com/example/villadihovo/web/controller/ControllersForHome/HomeController.java

Last change on this file was f7c05a1, checked in by Elena Shulevska <elena.shulevska@…>, 15 months ago

initial commit of the source code on origin

  • Property mode set to 100644
File size: 835 bytes
Line 
1package com.example.villadihovo.web.controller.ControllersForHome;
2
3import jakarta.servlet.http.HttpSession;
4import lombok.AllArgsConstructor;
5import org.springframework.stereotype.Controller;
6import org.springframework.ui.Model;
7import org.springframework.web.bind.annotation.GetMapping;
8import org.springframework.web.bind.annotation.RequestMapping;
9
10@Controller
11@AllArgsConstructor
12@RequestMapping({"/home"})
13public class HomeController {
14 @GetMapping
15 public String getHomePage(HttpSession session,Model model) {
16 String role;
17 if(session.getAttribute("role") == null){
18 role = "default";
19 session.setAttribute("role",role);
20 return "home";
21 }
22 return "home";
23 }
24 @GetMapping("/contact")
25 public String getContactPage(){
26 return "contact";
27 }
28}
Note: See TracBrowser for help on using the repository browser.