ITeye博客

Struts 中 OGNL for 循环

loquat · 2010-12-14 14:59 · Web前端 · Apache · Struts · Bean · Markdown

<div>
			<s:if test="#request.productPage.currentPage > 1">
				<a href="store.action?currentPage=<s:property value='#request.productPage.currentPage - 1'/>">上一页</a>	&nbsp;
			</s:if>			
			
			<s:bean name="org.apache.struts2.util.Counter" id="counter">
				<s:param name="first" value="0" />
				<s:param name="last" value="#request.productPage.pageCount -1" />
				<s:iterator>
					<s:if test="current == #request.productPage.currentPage">
						<s:property value="current" />
					</s:if>
					<s:else>
						<a href="store.action?currentPage=<s:property value="current" />"><s:property value="current" /></a>
					</s:else>
				</s:iterator>
			</s:bean>  
			

			<s:if test="#request.productPage.currentPage != #request.productPage.pageCount">
				<a href="store.action?currentPage=<s:property value="#request.productPage.currentPage + 1" />">下一页</a>
			</s:if>
			总页数: <s:property value="#request.productPage.pageCount" />

	</div>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。