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 | |
---|
1 | package com.example.villadihovo.web.controller.ControllersForHome;
|
---|
2 |
|
---|
3 | import jakarta.servlet.http.HttpSession;
|
---|
4 | import lombok.AllArgsConstructor;
|
---|
5 | import org.springframework.stereotype.Controller;
|
---|
6 | import org.springframework.ui.Model;
|
---|
7 | import org.springframework.web.bind.annotation.GetMapping;
|
---|
8 | import org.springframework.web.bind.annotation.RequestMapping;
|
---|
9 |
|
---|
10 | @Controller
|
---|
11 | @AllArgsConstructor
|
---|
12 | @RequestMapping({"/home"})
|
---|
13 | public 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.