美文网首页
springMVC中为什么不写 @RequestParam 也能

springMVC中为什么不写 @RequestParam 也能

作者: 我想起个好名字 | 来源:发表于2018-07-26 16:36 被阅读0次

三种写法,

1.test(String name),如果没有name 参数不会报错,

2.test(@RequestParam String name),:没有name 参数会报错,(也可以设置required = false),

3.test(@RequestParam("userName") String name),2和3 区别是name 参数换为userName。

相关文章

网友评论

      本文标题:springMVC中为什么不写 @RequestParam 也能

      本文链接:https://www.haomeiwen.com/subject/lyibmftx.html