你好我收到以下错误[不能因为同名的现有模型对象的暴露会话属性“用户”]错误与春季会议
javax.servlet.ServletException: Cannot expose session attribute 'user' because of an existing model object of the same name
org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:141)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
代码
@Controller
@RequestMapping("/admin")
@SessionAttributes("user")
public class AdminHome {
@RequestMapping("home")
public String homePage(HttpSession session, ModelMap map) {
map.addAttribute(org.brahmaa.ads.util.impl.UserInfo.getPrincipal(session));
return "admin/home";
}
}
这是什么时候发生的?这是全班上课吗? – Bozho 2011-01-27 08:46:45
它发生在我访问/ admin /主页时。是的,它是整个班级。 – nidhin 2011-01-27 09:21:33