问题
I have the following code snippet in Spring MVC (3.0).
@RequestMapping(value="/add", method = RequestMethod.POST)
public String handleAddResourceGroup(@Valid ResourceGroup resourceGroup, BindingResult bindingResult, Model model) {
if (bindingResult.hasErrors()) {
model.addAttribute("flash.validationErrors", bindingResult.getAllErrors());
return "add";
}
//The rest of the code
}
How can access the model attribute with the name "flash.validationErrors" in Freemarker?
回答1:
Try ${.data_model["flash.validationErrors"]}
来源:https://stackoverflow.com/questions/5379151/how-to-access-a-spring-mvc-model-attribute-name-that-contain-a-dot-in-freemarker