2

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";
Ivana
  • 35
  • 3
  • Please post the full stack trace and provide a [mre]. – Unmitigated Aug 21 '21 at 22:15
  • A couple quick things you should try are to put a breakpoint in the method and run in debug to see if it's getting invoked. The other, take the link out of the equation by accessing the url directly. Next, as was already pointed out, add more details that will provide the community with the necessary information to assist. – lane.maxwell Aug 21 '21 at 22:22
  • it is because you have not configured for error or exception scenarios. if something goes wrong, web app generally redirects to /error url which is obviously not configured – vaibhavsahu Aug 21 '21 at 22:40
  • I added error.html but it can not solve this problem, error page is showing – Ivana Aug 21 '21 at 22:48
  • You need to provide more information or we cannot help. – Unmitigated Aug 22 '21 at 03:55

0 Answers0