struts2 action接收不到前台传来的参数 10
链接struts.xmlactionpublicclassUserActionextendsActionSupport{/****/privatestaticfinall...
链接
struts.xml
action
public class UserAction extends ActionSupport { /** * */ private static final long serialVersionUID = 1L; private int page;//第几页 private int pageSize;//每页需要显示的记录数 private PageBean pageBean; private UserService userService; public int getPage() { return page; } public void setPage(int page) { this.page = page; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public PageBean getPageBean() { return pageBean; } public void setPageBean(PageBean pageBean) { this.pageBean = pageBean; } public UserService getUserService() { return userService; } public void setUserService(UserService userService) { this.userService = userService; } //分页查询 public String findByPage(){ System.out.println("当前页数"+page+"-------------------------------------"); System.out.println("pageSize="+pageSize); this.pageBean = userService.findByPage(10, page); return "findByPage"; }
}
控制台打印的 都是0 我传的参数是1和10
已经解决的 把action中的page以及pageSize属性 定义成Integer的就好了 展开
struts.xml
action
public class UserAction extends ActionSupport { /** * */ private static final long serialVersionUID = 1L; private int page;//第几页 private int pageSize;//每页需要显示的记录数 private PageBean pageBean; private UserService userService; public int getPage() { return page; } public void setPage(int page) { this.page = page; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public PageBean getPageBean() { return pageBean; } public void setPageBean(PageBean pageBean) { this.pageBean = pageBean; } public UserService getUserService() { return userService; } public void setUserService(UserService userService) { this.userService = userService; } //分页查询 public String findByPage(){ System.out.println("当前页数"+page+"-------------------------------------"); System.out.println("pageSize="+pageSize); this.pageBean = userService.findByPage(10, page); return "findByPage"; }
}
控制台打印的 都是0 我传的参数是1和10
已经解决的 把action中的page以及pageSize属性 定义成Integer的就好了 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询