模糊查询分页逻辑层 20
publicActionForwardexecute(ActionMappingmapping,ActionFormform,HttpServletRequestrequ...
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
ApplicationContext cxt = new ClassPathXmlApplicationContext(
"applicationContext.xml");
table = (ISearchTableDAO) cxt.getBean("searchTableDAO");
DynaValidatorForm f = (DynaValidatorForm) form;
SearchTable user = new SearchTable();
System.out.print(user.getTitle());
request.setAttribute("title", (String) f.get("title"));
int titlePage = 0;
String page = request.getParameter("page");
if (page == null || page.length() == 0) {
page = "1";
}
try {
titlePage = Integer.parseInt(page);
} catch (Exception e) {
}
;
if (titlePage == 0) {
titlePage = 1;
}
int titleSize = 3;
List list = table.findTitleAll((String) f.get("title"), titlePage,
titleSize);
if(list.size()>0){
System.out.print(list.size());
request.setAttribute("list", list);
System.out.print("kkk");
request.setAttribute("titlePageSize", table
.titlePageCount(titleSize));
request.setAttribute("userCurrentAll", table.titleUserCount());
request.setAttribute("titleCurrentPage", titlePage);
System.out.print("aaa");
return mapping.findForward("success");
}
return mapping.findForward("failed");
}
不知道我哪里错了,为什么连接下一页的时候却不会再次执行action
下一页连接[<a
href="${pageContext.request.contextPath}/searchAdmin.do?page=${currentPage+1}">下一页</a>]
郁闷,有会的帮我下 展开
HttpServletRequest request, HttpServletResponse response) {
ApplicationContext cxt = new ClassPathXmlApplicationContext(
"applicationContext.xml");
table = (ISearchTableDAO) cxt.getBean("searchTableDAO");
DynaValidatorForm f = (DynaValidatorForm) form;
SearchTable user = new SearchTable();
System.out.print(user.getTitle());
request.setAttribute("title", (String) f.get("title"));
int titlePage = 0;
String page = request.getParameter("page");
if (page == null || page.length() == 0) {
page = "1";
}
try {
titlePage = Integer.parseInt(page);
} catch (Exception e) {
}
;
if (titlePage == 0) {
titlePage = 1;
}
int titleSize = 3;
List list = table.findTitleAll((String) f.get("title"), titlePage,
titleSize);
if(list.size()>0){
System.out.print(list.size());
request.setAttribute("list", list);
System.out.print("kkk");
request.setAttribute("titlePageSize", table
.titlePageCount(titleSize));
request.setAttribute("userCurrentAll", table.titleUserCount());
request.setAttribute("titleCurrentPage", titlePage);
System.out.print("aaa");
return mapping.findForward("success");
}
return mapping.findForward("failed");
}
不知道我哪里错了,为什么连接下一页的时候却不会再次执行action
下一页连接[<a
href="${pageContext.request.contextPath}/searchAdmin.do?page=${currentPage+1}">下一页</a>]
郁闷,有会的帮我下 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询