![]() |
1
1
表单标记的默认modelattribute为command。在引用的示例中,“魔法”发生在:
ModelAndView构造函数的第二个和第三个参数负责将新的学生对象绑定到表单标记默认modelattribute“command” 在post接收方法中,modelattribute注释“SpringWeb”的名称值
也可以删除
|
![]() |
2
0
在进一步研究之后,我发现“SpringWeb”只是一些在线教程中为提交的“表单”的model属性指定的默认名称。这在许多其他教程中都有复制。Spring在注释@ModelAttribute(“xyz”)中为模型属性命名。 事实上,在许多情况下并不需要@ModelAttribute注释。有关此批注使用情况的更多详细信息,请参见: @ModelAttribute annotation, when to use it? |
![]() |
Mayur · maven项目中找不到文件异常找不到xml文件 3 年前 |
![]() |
Mayur · 我试图导入(import org.springframework.context.ApplicationContext),但它给了我错误org。Sprigframew无法解决 3 年前 |
![]() |
Pasha · 如何在@RequestBody中传递2个对象? 6 年前 |
![]() |
Halil · Spring MVC-有条件返回html内容或模板内容 6 年前 |
![]() |
M.K · 实现easy REST服务的问题-Spring MVC 6 年前 |