首页
诗词
字典
板报
句子
名言
友答
励志
学校
网站地图
Web前端
Dreamweaver
Fireworks
Flash
ASP
asp.net
PHP
JSP
SEO优化
源码建站
CSS
Web开发
Web前端
JavaScript
vbScript
Ajax
网页设计
跨浏览器开发
高性能WEB开发
Web Service
XML SOAP
当前位置:
首页
>
教程频道
>
网站开发
>
Web前端
>
struts2、webwork 循环的应用,实现for功能
2012-10-31
struts2、webwork 循环的使用,实现for功能在struts2及webwork中要实现如:/* ?*?$Id:?Counter.java?471756?2
struts2、webwork 循环的使用,实现for功能
在struts2及webwork中要实现如:
/* ?
*?$Id:?Counter.java?471756?2006-11-06?15:01:43Z?husted?$ ?
* ?
*?Licensed?to?the?Apache?Software?Foundation?(ASF)?under?one ?
*?or?more?contributor?license?agreements.???See?the?NOTICE?file ?
*?distributed?with?this?work?for?additional?information ?
*?regarding?copyright?ownership.???The?ASF?licenses?this?file ?
*?to?you?under?the?Apache?License,?Version?2.0?(the ?
*?"License");?you?may?not?use?this?file?except?in?compliance ?
*?with?the?License.???You?may?obtain?a?copy?of?the?License?at ?
* ?
*??http://www.apache.org/licenses/LICENSE-2.0 ?
* ?
*?Unless?required?by?applicable?law?or?agreed?to?in?writing, ?
*?software?distributed?under?the?License?is?distributed?on?an ?
*?"AS?IS"?BASIS,?WITHOUT?WARRANTIES?OR?CONDITIONS?OF?ANY ?
*?KIND,?either?express?or?implied.???See?the?License?for?the ?
*?specific?language?governing?permissions?and?limitations ?
*?under?the?License. ?
*/??
package?org.apache.struts2.util; ??
??
import?java.io.Serializable; ??
??
??
/** ?
*?A?bean?that?can?be?used?to?keep?track?of?a?counter. ?
*?
?
?
*?Since?it?is?an?Iterator?it?can?be?used?by?the?iterator?tag ?
* ?
*/??
public?class?Counter?implements?java.util.Iterator,?Serializable?{ ??
??
?????private?static?final?long?serialVersionUID?=?2796965884308060179L; ??
??
?????boolean?wrap?=?false; ??
??
?????//?Attributes?---------------------------------------------------- ??
?????long?first?=?1; ??
?????long?current?=?first; ??
?????long?interval?=?1; ??
?????long?last?=?-1; ??
??
??
?????public?void?setAdd(long?addition)?{ ??
?????????current?+=?addition; ??
?????} ??
??
?????public?void?setCurrent(long?current)?{ ??
?????????this.current?=?current; ??
?????} ??
??
?????public?long?getCurrent()?{ ??
?????????return?current; ??
?????} ??
??
?????public?void?setFirst(long?first)?{ ??
?????????this.first?=?first; ??
?????????current?=?first; ??
?????} ??
??
?????public?long?getFirst()?{ ??
?????????return?first; ??
?????} ??
??
?????public?void?setInterval(long?interval)?{ ??
?????????this.interval?=?interval; ??
?????} ??
??
?????public?long?getInterval()?{ ??
?????????return?interval; ??
?????} ??
??
?????public?void?setLast(long?last)?{ ??
?????????this.last?=?last; ??
?????} ??
??
?????public?long?getLast()?{ ??
?????????return?last; ??
?????} ??
??
?????//?Public?-------------------- ??
?????public?long?getNext()?{ ??
?????????long?next?=?current; ??
?????????current?+=?interval; ??
??
?????????if?(wrap?&&?(current?>?last))?{ ??
?????????????current?-=?((1?+?last)?-?first); ??
?????????} ??
??
?????????return?next; ??
?????} ??
??
?????public?long?getPrevious()?{ ??
?????????current?-=?interval; ??
??
?????????if?(wrap?&&?(current?<?first))?{ ??
?????????????current?+=?(last?-?first?+?1); ??
?????????} ??
??
?????????return?current; ??
?????} ??
??
?????public?void?setWrap(boolean?wrap)?{ ??
?????????this.wrap?=?wrap; ??
?????} ??
??
?????public?boolean?isWrap()?{ ??
?????????return?wrap; ??
?????} ??
??
?????public?boolean?hasNext()?{ ??
?????????return?((last?==?-1)?||?wrap)???true?:?(current?<=?last); ??
?????} ??
??
?????public?Object?next()?{ ??
?????????return?new?Long(getNext()); ??
?????} ??
??
?????public?void?remove()?{ ??
?????????//?Do?nothing ??
?????} ??
} ??
??
</s:iterator>
</s:bean>
查看更多
下一篇
本文网址:
https://www.reader8.com/jiaocheng/20121031/1376474.html
读书人精选
热点排行
jquery的after与insertAfter的差异
牛角尖啊牛角尖
weblogic 认证回绝 Authentication for
菜鸟阅读Servlet源码值得注意的地方
[转]Remote Debugging with Eclipse + W
(四)事件处理——(6)给.ready()回调
(四)事件处理——(8)一个简单的风格
元素正中的几种方法
判断iframe是不是加载完毕的方法(兼容i
velocity获取session值并判断是不是成