ITeye博客

springmvc参数传递

itgo · 2014-06-17 17:10 · springmvc · 编程语言 · Markdown

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

 

@RequestParam(value="currentPage")

 

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

否则报无参数错误。

 

这时,可以设置默认值

 

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

 

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。