How to access a Spring MVC model attribute name that contain a dot in Freemarker

会有一股神秘感。 提交于 2019-12-13 13:16:43

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!