Spring @GetMapping annotation does not work

Viewed 127

I have href in index.html which should redirect to showNewBook and then it should redirect to new_book.index but when I click on the link there is an error which says "Whitelabel Error Page, This application has no explicit mapping for /error, so you are seeing this as a fallback."

<a th:href="@{/showNewBookForm}" class="btn btn-primary btn-sm mb-3">Add new book</a>
@GetMapping(value="/showNewBookForm")
    public String showNewBookForm(Model model) {
        Book book=new Book();
        model.addAttribute("book",book);
        return "new_book";
0 Answers
Related