Thursday, July 6, 2017

spring: thymeleaf: SpringInputGeneralFieldAttrProcessor Error



>PROBLEM

Running spring and thymeleaf, returns the following error page:


Whitelabel Error Page

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

Thu Jul 06 17:16:04 BRT 2017
There was an unexpected error (type=Internal Server Error, status=500).
Error during execution of processor 'org.thymeleaf.spring4.processor.attr.SpringInputGeneralFieldAttrProcessor' (login)




>SOLUTION

Since the log is pointing to login, open the class which should have the respective attribute.
To find out, go to the page which is returning the error. The page may be found in the controller.
In this example we get:

@RequestMapping(value = "/", method = RequestMethod.GET)
public String addNewLogin(Login login) {
return "login";
}

Opening the page, check the object pointed by thymeleaf's "th:object" property in form tag.
In this example is "th:object="${login}".
The error message means that the parser is complaining that it was not found the attribute login for Login class.








Opening the respective Login class, you get instead of "login" the "signin" attribute.


]


Switch the wrong attribute by the correct one, as below:









 Now refresh page, and that's it!  :-)


>ENV
Java
Spring boot
Thymeleaf
Eclipse

No comments:

Post a Comment

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...