1 22 23 package org.cofax.taglibs; 24 25 import javax.servlet.jsp.*; 26 import javax.servlet.jsp.tagext.*; 27 import java.io.*; 28 29 39 public class RepeatTag extends BodyTagSupport { 40 41 PackageTag parent; 42 43 46 public int doStartTag() { 47 parent = (PackageTag) findAncestorWithClass(this, PackageTag.class); 48 if ((parent != null) && (!parent.getNoRows())) { 50 return EVAL_BODY_TAG; 51 } else { 52 return SKIP_BODY; 53 } 54 } 55 56 59 public int doAfterBody() throws JspException { 60 61 BodyContent body = getBodyContent(); 62 try { 63 body.writeOut(getPreviousOut()); 64 parent.nextRow(); 65 } catch (IOException e) { 66 parent.printMessage("Error in IO body repeat" + e); 67 } 68 body.clearBody(); 69 70 if (parent.getHasRowData()) { 71 return EVAL_BODY_TAG; 72 } else { 73 return SKIP_BODY; 74 } 75 76 } 77 78 81 public int doEndTag() { 82 return EVAL_PAGE; 83 } 84 85 } 87 | Popular Tags |