hibernate+struts 分页,为什么我点击删除,返回过去的分页id累加,为什么 hibernate+struts 分页,为什么我点击删除,返回过去的分页id累加,为什么 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 jsp 页面<tbody> <c:choose> <c:when test="${empty pageList.recordsDate}"> <tr> <td colspan="10" height="60" valign="middle" align="center"> 没有符合的数据 </td> </tr> </c:when> <c:otherwise> <c:forEach var="list" items="${pageList.recordsDate}"> <tr> <td align="center"> <input type="checkbox" name="checkbox" id="checkbox" /> </td> <td align="center"> ${list.title} </td> <td align="center"> ${list.article_id} </td> <td align="center"> ${list.createTime} </td> <td> <a href="<%=basePath%>/queryByExample.do?method=saveUpdate&id=${list.id}">编辑</a> <a href="<%=basePath%>queryByExample.do?method=delete&id=${list.id}">删除</a> </td> </tr> </c:forEach> <tr> <td colspan="5" align="center"> 总记录:${pageList.total} 当前页: <font color="red">${current }</font>/${pageList.totalPage} <a href="<%=basePath %>pageModel.do?method=pageAction&id=currentPage=1">首页</a> <a href="<%=basePath %>pageModel.do?method=pageAction&id=${current>1?current-1:"1"}">上一页</a> <a href="<%=basePath %>pageModel.do?method=pageAction&id=${current<pageList.totalPage?current+1:pageList.totalPage}">下一页</a> <a href="<%=basePath %>pageModel.do?method=pageAction&id=${pageList.totalPage}">尾页</a> </td> </tr> </c:otherwise> </c:choose> </tbody>action 页面 public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int currentPage = 1; int maxPage = 3; System.out.println(toString()); FForm tf = (FForm) form; System.out.println(tf.getId()); PageModel om = new PageModel(); try { if(tf.getId() > 0){ currentPage = tf.getId(); } om = articleService.findByScrollServer((currentPage - 1) * maxPage, maxPage); request.setAttribute("current", currentPage); request.setAttribute("pageList", om); } catch (Exception e) { e.printStackTrace(); } return mapping.findForward("page"); }struts-config.xml 页面<action path="/queryByExample" type="com.zjgr.web.action.ArticleAction" name="articleForm" input="/admin/html/content_1.jsp" parameter="method"> <forward name="del" path="/admin/html/test.jsp"></forward> </action> <action path="/pageModel" type="com.zjgr.web.action.PageModelAction" name="fForm" input="/admin/html/content_1.jsp"> <forward name="page" path="/admin/html/content_1.jsp" /> </action>删除public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ArticleForm af = (ArticleForm) form; try { ContentManage cm = articleService.findById(af.getId()); articleService.del(cm); } catch (Exception e) { e.printStackTrace(); } return mapping.findForward("del"); } 进行分页中,在删除操作中你使用的什么属性来接收id,是使用id属性吗? jsp 嵌套 flex自动生成的.html 文件出现问题 求解!~~ 为什么运行不了 TOMCAT-6.0.32中连接数据库连接池报错PoolableConnectionFactory 'SESSION VARIABLES' 这是怎么回事? 页面右侧最多有四个滚动杆,这样好看吗? 关于jdk的问题 100分的菜鸟级问题! my97datepicker获取到的时间如何存储到数据库中?时间已经精确到时分秒。 用JSP获取客户端IP这个为何不行 sql的寫法 ExtJs中gridpanel调不到后台数据,求帮助 Javascript操作class
<c:choose>
<c:when test="${empty pageList.recordsDate}">
<tr>
<td colspan="10" height="60" valign="middle" align="center">
没有符合的数据
</td>
</tr>
</c:when>
<c:otherwise>
<c:forEach var="list" items="${pageList.recordsDate}">
<tr>
<td align="center">
<input type="checkbox" name="checkbox" id="checkbox" />
</td>
<td align="center">
${list.title}
</td>
<td align="center">
${list.article_id}
</td>
<td align="center">
${list.createTime}
</td>
<td>
<a
href="<%=basePath%>/queryByExample.do?method=saveUpdate&id=${list.id}">编辑</a>
<a
href="<%=basePath%>queryByExample.do?method=delete&id=${list.id}">删除</a>
</td>
</tr>
</c:forEach>
<tr>
<td colspan="5" align="center">
总记录:${pageList.total} 当前页:
<font color="red">${current }</font>/${pageList.totalPage}
<a href="<%=basePath %>pageModel.do?method=pageAction&id=currentPage=1">首页</a>
<a href="<%=basePath %>pageModel.do?method=pageAction&id=${current>1?current-1:"1"}">上一页</a>
<a href="<%=basePath %>pageModel.do?method=pageAction&id=${current<pageList.totalPage?current+1:pageList.totalPage}">下一页</a>
<a href="<%=basePath %>pageModel.do?method=pageAction&id=${pageList.totalPage}">尾页</a>
</td>
</tr>
</c:otherwise>
</c:choose>
</tbody>action 页面 public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
int currentPage = 1;
int maxPage = 3;
System.out.println(toString());
FForm tf = (FForm) form;
System.out.println(tf.getId());
PageModel om = new PageModel();
try {
if(tf.getId() > 0){
currentPage = tf.getId();
}
om = articleService.findByScrollServer((currentPage - 1) * maxPage, maxPage);
request.setAttribute("current", currentPage);
request.setAttribute("pageList", om);
} catch (Exception e) {
e.printStackTrace();
}
return mapping.findForward("page");
}
struts-config.xml 页面<action path="/queryByExample" type="com.zjgr.web.action.ArticleAction"
name="articleForm" input="/admin/html/content_1.jsp" parameter="method">
<forward name="del" path="/admin/html/test.jsp"></forward>
</action>
<action path="/pageModel" type="com.zjgr.web.action.PageModelAction"
name="fForm" input="/admin/html/content_1.jsp">
<forward name="page" path="/admin/html/content_1.jsp" />
</action>
删除public ActionForward delete(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ArticleForm af = (ArticleForm) form;
try {
ContentManage cm = articleService.findById(af.getId());
articleService.del(cm);
} catch (Exception e) {
e.printStackTrace();
}
return mapping.findForward("del");
}