How to access a Spring MVC model attribute name th

2019-06-26 02:29发布

问题:

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"]}