controller中获取不到jsp传递的值

Ubuntu丶 Ubuntu丶 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
jsp
<a href="show.do">首页</a>  
<a href="show.do&page=${cpu.page - 1 }">上一页</a>  
<a href="show.do&page=${cpu.page + 1 }">下一页</a>  
<a href="show.do&page=${cpu.pages }">末页</a>

controller
@RequestMapping("show.do")
public String showAllCommodity(HttpServletRequest request,HttpServletResponse response)
throws Exception {
request.setCharacterEncoding("UTF-8");
CommodityPagesUtils cpu = new CommodityPagesUtils();

int page = 1;
if(null!=request.getParameter("page")&&!"".equals(request.getParameter("page"))){
page = Integer.parseInt(request.getParameter("page"));
}
System.out.println(page);
cpu.setPage(page);
cpu.setSize(5);
cpu = commodityService.getAllComByPage(cpu);
request.getSession().setAttribute("cpu", cpu);
System.out.println(cpu.getPage());
return "commodity.jsp";
}
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
Ubuntu丶
Web 开发 81,107 成员 341,720 内容