在Spring MVC的@modelattribute中添加可选参数

时间:2019-04-11 17:12:42

标签: spring-mvc

我正在研究Spring MVC,我想在modelattribute中将一些参数设置为可选参数。 例如我们可以使用@RequestMapping通过required = false设置可选参数。所以我在@modelattribute中需要这样的东西。我不想使用RequestParam,因为我有很多参数。还有其他办法吗?

1 个答案:

答案 0 :(得分:0)

请随时使用ModelAttribute,因为这些值将默认填充为默认值,例如0,代表整数,有关更多信息,请访问here