javameal

难得认真!

BlogJava 联系 聚合 管理
  4 Posts :: 1 Stories :: 9 Comments :: 0 Trackbacks
struts2.0.11版本不支持el,因而以前在低版本下写和程式将不能正常运行:
下面是一段分页所用的循环:
<c:forEach var="i" begin="1" end="${requestScope.page.afterPage}" step="1">
    <c:if
     test="${requestScope.page.indexPage<requestScope.page.totalPage && requestScope.page.indexPage+i<requestScope.page.totalPage}">
     <s:url id="afterUrl" value="/photoItemsList.html">
          <s:param name="indexPage" value="${requestScope.page.indexPage+i}" /><!-- struts2.0.11中已不支持el,因而<s:url>将取不到相关值-->
     </s:url>
     <s:a theme="ajax" href="%{afterUrl}" indicator="indicator" showLoadingText="false" targets="pageItems">
          <c:out value="${requestScope.page.indexPage+i}" />&nbsp;</s:a>
    </c:if>
   </c:forEach>

修改成如下:
<c:forEach var="i" begin="1" end="${requestScope.page.afterPage}" step="1">
    <c:set value="${i}" var="var"/>
    <c:if   test="${requestScope.page.indexPage<requestScope.page.totalPage && requestScope.page.indexPage+i<requestScope.page.totalPage}">
     <s:url id="afterUrl" value="/photoItemsList.html">
          <s:param name="indexPage" value="#request.page.indexPage+#attr.var" />
     </s:url>
     <s:a theme="ajax" href="%{afterUrl}" indicator="indicator" showLoadingText="false" targets="pageItems">
          <c:out value="${requestScope.page.indexPage+i}" />&nbsp;</s:a>
    </c:if>
   </c:forEach>



posted on 2008-03-18 09:01 javameal 阅读(741) 评论(0)  编辑  收藏 所属分类: java

只有注册用户登录后才能发表评论。


网站导航: