I am building an application using Spring, Hibernate and of course Thymeleaf for the views. The application is centered around an Activity domain class (which is literally an i
I know its a bit late,. but anyone searching for the solution...
To use the *{fieldname} select option you should use the th:value with 2 curly brackets
You need to add a formatter:
public class RoadmapFormatter implements Formatter {
@Override
public Roadmap parse(String id, Locale locale) throws ParseException {
Roadmap r = new Roadmap();
r.setId(Long.parseLong(id));
return r;
}
@Override
public String print(Roadmap r, Locale locale) {
return String.valueOf(r.getId());
}
}
Last but not least register the formatter in the configuration class:
@Configuration
public class Configuration implements WebMvcConfigurer {
@Override
public void addFormatters(FormatterRegistry formatterRegistry) {
formatterRegistry.addFormatter(new RoadmapFormatter());
}
}