用struts的标签    <s:iterator> 标签在页面上遍历,记得 必须先引入标签库

解决方案 »

  1.   

    还有,我的代码的页面是用struts标签显示的,我把相关代码再帖出来吧
    <logic:present name="list" scope="request">
    <logic:iterate id="ele" name="list" scope="request">
    <tr bgcolor="#FFFFFF">
    <td>
    <bean:write name="ele" property="id" />
    </td>
    <td>
    <html:link href="category.do?command=edit" paramId="id"
    paramName="ele" paramProperty="id">
    <bean:write name="ele" property="name" />
    </html:link>
    </td>
    <td>
    <bean:write name="ele" property="subDesc" />
    </td>
    <td>
    <bean:write name="ele" property="createTime"
    format="yyyy-MM-dd" />
    </td>
    <td>
    <html:link href="category.do?command=edit" paramId="id"
    paramName="ele" paramProperty="id">
    <bean:message key="system.modify" />
    </html:link>
    <html:link href="category.do?command=delete" paramId="id"
    paramName="ele" paramProperty="id">
    <bean:message key="system.delete" />
    </html:link>
    </td>
    </tr>
    </logic:iterate>
    <logic:present name="pagingBar" scope="request">
    <tr bgcolor="#FFFFFF">
    <td colspan="5" align="right">
    <bean:write name="pagingBar" filter="false" scope="request" />
    </td>
    </tr>
    </logic:present>
    </logic:present>
    <logic:notPresent name="list" scope="request">
    <tr bgcolor="#FFFFFF">
    <td colspan="5">
    <bean:message key="system.message.null" />
    </td>
    </tr>
    </logic:notPresent>Action代码:
    //分页
    public ActionForward paging(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
    //获取当前页码
    String currPage = request.getParameter("currPage");
    String action = request.getContextPath()+"/baseData/category.do?command=paging";
    String hql = "from Category";
    //分页查询
    Map map = this.getPage(hql, recPerPage, currPage, action,null);
    //将结果集放到request中
    request.setAttribute("list", map.get("list"));
    //将结果集放到分页条中
    request.setAttribute("pagingBar", map.get("bar"));
    return mapping.findForward("findAllSuccess");
    }
    请问具体怎么修改?谢谢!