I'm trying to write an application on https://www.toptal.com/spring/beginners-guide-to-mvc-with-spring-framework It starts successfully, but on localhost it says:

Whitelabel Error Page

This application has been explicitly mapping for / error, so you are seeing this as a fallback.

How to fix it in this project?

In HTML in a row by type

<tr th:each="student : ${students}"> 

students

stands out as an error. Why?

TO

  • Not enough information to help you. Is there anything in the console? Give a piece of code from the controller of the view. - Slava Semushin
  • Completed. There are no errors in the console. each message has an INFO tag. - Wenti
  • Is the namespace defined for th? (xmlns: th = " thymeleaf.org" ) Again - is thymeleaf connected correctly? - Nikolay Romanov
  • How to determine the correctness of thymeleaf connection? - Wenti
  • Check what studentRepository.findAll() returns. Try running in debug mode (add debug: false in application.properties ) to see more messages in the log. Is your project available anywhere (in the sense of the source code)? - Slava Semushin

2 answers 2

Problem # 1: nothing is stale / nothing, so when you open the site you see a similar error.

Problem # 2: if you contact /students , another error appears, but another one: Exception evaluating SpringEL expression: "student.forename + ' ' + student.surame" (students:16) . If you look at it very carefully, it’s already clear what the matter is, but just in case you can look at the console for an exception: org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 33): Property or field 'surame' cannot be found on object of type 'wenti.entity.Student' - maybe not public? The reason is a banal typo - you refer to the surame field, instead of surname .

    The error says that the wrong mapping at /error . Spring redirects you to the /error page when your GET request failed on the server.

    What are the options 1. Error when receiving / processing data on the server (as an example of NullPointerException ). Go through the debugging of the code, see if the exception is missing. 2. Error parsing the thymeleaf page.

    Look at the log, most likely your error is higher than what you indicated in the passage.

    • When running, there are no ERROR lines in the output, only INFO. How to check errors when parsing a page? - Wenti pm