`
itgo
  • 浏览: 2726 次
  • 性别: Icon_minigender_1
  • 来自: 广州
最近访客 更多访客>>
社区版块
存档分类
最新评论

springmvc参数传递

阅读更多

在做一个分页功能的时候,使用springmvc,使用变量currentPage代表当前页面,打开页面的时候currentPage为1,修改页面的时候用get方法修改currentPage

 

@RequestParam(value="currentPage")

 

但是,每次打开都要加个小尾巴 :    ?currentPage=1

否则报无参数错误。

 

这时,可以设置默认值

 

@RequestParam(value="currentPage",defaultValue="1")

 

页面就可以不用加小尾巴了

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics