Créer un site internet


Let's find a solution for an issue in the book Spring in action chapter 3. The web page Design.html provides a list of Ingredients in a form of checkbox. When the user selects the ingredients and post the result. This result is a String of selected objects which is incompatible with the Object "Ingredient. Following is the error stacktrace.


Caused by: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'design' available as request attribute at<init>( at at org.thymeleaf.spring5.context.webmvc.SpringWebMvcThymeleafRequestContext.getBindStatus( at org.thymeleaf.spring5.util.FieldUtils.getBindStatusFromParsedExpression( at org.thymeleaf.spring5.util.FieldUtils.getBindStatus( at org.thymeleaf.spring5.util.FieldUtils.getBindStatus( at org.thymeleaf.spring5.processor.AbstractSpringFieldTagProcessor.doProcess( at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess( ... 67 more

To correct this error, we have to create a Converter class to convert the result from String to ingredient as follow

Add a comment