Thymeleaf not redirecting to any page beside index.html

60 views Asked by At

So basically my issue is I can get the index or the front page for my spring boot application to load but any redirection or anything I do outside of the pages returns a whitelabel error.

The file structure looks as below:

enter image description here

The login controller is like this:

enter image description here

And the page I'm trying to redirect to is the register.html and the controller for that looks as below:

enter image description here

Any help with this would be greatly appreciated.

1

There are 1 answers

0
Rafael Guillen On BEST ANSWER

You can organize controllers and navigation this way:

@Controller
@RequestMapping("/index")
public class IndexController {

    @GetMapping()
    public String get(Model model) {
        return "index";
    }
...

}

@Controller
@RequestMapping("/account")
public class AccountController {

    @GetMapping()
    public String get(Model model) {
        return "account";
    }
...

}

@Controller
@RequestMapping("/register")
public class RegisterController {

    @GetMapping()
    public String get(Model model) {
        return "register";
    }
...

}