I got from my repository Flux and in my controller I want to send it to my template. my controller:
@GetMapping("users")
public String getAllUser(Model model){
Flux<User> all = userRepo.findAll();
model.addAttribute("user", all);
return "mainpage";
}
I getting error in my Freemarker's template:
${user.content} оr ${user}
reemarker.core.InvalidReferenceException: The following has evaluated to null or missing: ==> user
Question is, what do you need to call in Java to get the content
of the user
? When you write user.content
in the template, with the default configuration FreeMarker will try things like user.getContent()
, and user.get("content")
. But this can be customized, with Configuration.setObjectWrapper
. You could extend DefaultObjectWrapper
so that it's aware of the Flux
API.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.