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
|
Rev | Line | |
---|
[f0232fb] | 1 | package finki.paw5.web.controllers;
|
---|
| 2 |
|
---|
[b00d81b] | 3 | import jakarta.servlet.http.HttpServletRequest;
|
---|
[f0232fb] | 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
|
---|
[b00d81b] | 13 | public String getHomePage(HttpServletRequest request) {
|
---|
| 14 | if(request.getSession().getAttribute("user")==null){
|
---|
| 15 | return "redirect:/login";
|
---|
| 16 | }
|
---|
[f0232fb] | 17 | return "home";
|
---|
| 18 | }
|
---|
[b00d81b] | 19 |
|
---|
[f0232fb] | 20 | @GetMapping("/aboutUs")
|
---|
[b00d81b] | 21 | public String getSuccessPage() {
|
---|
[f0232fb] | 22 | return "/aboutUs";
|
---|
| 23 | }
|
---|
| 24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.