如果我向ModelMap添加属性:

    model.addAttribute("abc", 123);

并显示视图:
@RequestMapping(value = "/foo", method = RequestMethod.GET)
public final String foo(HttpServletRequest request, BindingResult bindResult, ModelMap model) {
    model.addAttribute("abc", 123);
    return "foo";
}

我在浏览器地址栏中看到了这一点:
http://localhost:6060/foo?abc=123

是否可以向模型添加属性而不将其显示为查询字符串的名称/值对? (我正在使用Spring MVC 3.0)

最佳答案

您可能在控制器中的某处使用了@ModelAttribute批注。
请参阅此question的答案。

关于java - 您如何将信息放入ModelMap中而不​​出现在查询字符串中?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6155417/

10-08 23:20