hibernate+struts 分页,为什么我点击删除,返回过去的分页id累加,为什么

解决方案 »

  1.   

    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>&nbsp;&nbsp;
    <a
    href="<%=basePath%>queryByExample.do?method=delete&id=${list.id}">删除</a>
    </td>
    </tr>
     </c:forEach>
     <tr>
    <td colspan="5" align="center">
    总记录:${pageList.total}&nbsp; 当前页:
    <font color="red">${current }</font>/${pageList.totalPage}
    &nbsp;&nbsp;&nbsp;
    <a href="<%=basePath %>pageModel.do?method=pageAction&id=currentPage=1">首页</a> &nbsp;&nbsp;
    <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> &nbsp;&nbsp;
    <a href="<%=basePath %>pageModel.do?method=pageAction&id=${pageList.totalPage}">尾页</a> &nbsp;&nbsp;
    </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");
    }
      

  2.   

    进行分页中,在删除操作中你使用的什么属性来接收id,是使用id属性吗?