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}" /> </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}" /> </s:a>
</c:if>
</c:forEach>