1 16 package org.apache.cocoon.taglib.test; 17 18 import org.apache.cocoon.taglib.IterationTag; 19 import org.apache.cocoon.taglib.TagSupport; 20 import org.xml.sax.Attributes ; 21 import org.xml.sax.SAXException ; 22 23 27 public class IterationTestTag extends TagSupport implements IterationTag { 28 29 private int i = 0; 30 private int count = 2; 31 32 35 public int doStartTag(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { 36 if (count > 0) 37 return EVAL_BODY; 38 return SKIP_BODY; 39 } 40 41 44 public int doAfterBody() throws SAXException { 45 if (++i >= count) 46 return SKIP_BODY; 47 return EVAL_BODY_AGAIN; 48 } 49 50 public void setCount(String count) { 51 this.count = Integer.parseInt(count); 52 } 53 54 57 public void recycle() { 58 i = 0; 59 count = 2; 60 super.recycle(); 61 } 62 } 63 | Popular Tags |