Issue
I have Java object with some fields
private static Film film;
static {
film = new Film();
film.setTitle("Inception");
film.setYear(2010);
film.setGenre("sci-fi");
film.setWatched(true);
I want to display all fields on my jsp page and I using this construction
<body>
${film.toString()}
</body>
But it's not working and I get just empty page. How can I fix this? Or maybe use other way?
Controler
@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView allFilms() {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("films");
modelAndView.addObject("film", film);
return modelAndView;
Solution
Problem was that I didn't add thymeleaf link to header xmlns:th="http://www.thymeleaf.org"
Answered By - Artur May
Answer Checked By - Terry (JavaFixing Volunteer)