main
Last change
on this file since cadbec3 was b00d81b, checked in by SazdovaEkaterina <sazdovaekaterina@…>, 19 months ago |
home redirects to login if not logged in
|
-
Property mode
set to
100644
|
File size:
641 bytes
|
Line | |
---|
1 | package finki.paw5.web.controllers;
|
---|
2 |
|
---|
3 | import jakarta.servlet.http.HttpServletRequest;
|
---|
4 | import org.springframework.stereotype.Controller;
|
---|
5 | import org.springframework.web.bind.annotation.GetMapping;
|
---|
6 | import org.springframework.web.bind.annotation.RequestMapping;
|
---|
7 |
|
---|
8 | @Controller
|
---|
9 | @RequestMapping("/home")
|
---|
10 | public class HomeController {
|
---|
11 |
|
---|
12 | @GetMapping
|
---|
13 | public String getHomePage(HttpServletRequest request) {
|
---|
14 | if(request.getSession().getAttribute("user")==null){
|
---|
15 | return "redirect:/login";
|
---|
16 | }
|
---|
17 | return "home";
|
---|
18 | }
|
---|
19 |
|
---|
20 | @GetMapping("/aboutUs")
|
---|
21 | public String getSuccessPage() {
|
---|
22 | return "/aboutUs";
|
---|
23 | }
|
---|
24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.