1 53 54 106 107 package com.Yasna.forum.tags; 108 109 import java.io.*; 110 import java.util.*; 111 import java.text.*; 112 import javax.servlet.*; 113 import javax.servlet.jsp.*; 114 import javax.servlet.jsp.tagext.*; 115 import javax.servlet.http.*; 116 import com.Yasna.forum.*; 117 import com.Yasna.forum.tags.*; 118 119 142 143 public class WhileChildTag extends BodyTagSupport 144 { 145 private WalkTag wt = null; 146 private int thread_depth = 0; 147 148 153 public final int doStartTag() throws JspException 154 { 155 try { 157 wt = (WalkTag)this.findAncestorWithClass(this, 158 Class.forName("com.Yasna.forum.tags.WalkTag")); 159 } catch(Exception e) { 160 return SKIP_BODY; 161 } 162 163 thread_depth = wt.getDepth(); 165 if( thread_depth > 0 ) 166 return EVAL_BODY_TAG; 167 return SKIP_BODY; 168 } 169 170 175 public final int doAfterBody() throws JspException 176 { 177 thread_depth--; 178 if( thread_depth > 0 ) 179 return EVAL_BODY_TAG; 180 return SKIP_BODY; 181 } 182 183 188 public final int doEndTag() throws JspException 189 { 190 try 191 { 192 if(bodyContent != null) 193 bodyContent.writeOut(bodyContent.getEnclosingWriter()); 194 } catch(java.io.IOException e) 195 { 196 throw new JspException("IO Error: " + e.getMessage()); 197 } 198 return EVAL_PAGE; 199 } 200 201 } 202 | Popular Tags |