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 public class WhileParentTag extends BodyTagSupport 143 { 144 private WalkTag wt = null; 145 private int thread_depth = 0; 146 147 152 public final int doStartTag() throws JspException 153 { 154 try { 156 wt = (WalkTag)this.findAncestorWithClass(this, 157 Class.forName("com.Yasna.forum.tags.WalkTag")); 158 } catch(Exception e) { 159 return SKIP_BODY; 160 } 161 162 thread_depth = wt.getDepth(); 164 if( thread_depth > 0 ) 165 return EVAL_BODY_TAG; 166 return SKIP_BODY; 167 } 168 169 174 public final int doAfterBody() throws JspException 175 { 176 thread_depth--; 177 if( thread_depth > 0 ) 178 return EVAL_BODY_TAG; 179 return SKIP_BODY; 180 } 181 182 187 public final int doEndTag() throws JspException 188 { 189 try 190 { 191 if(bodyContent != null) 192 bodyContent.writeOut(bodyContent.getEnclosingWriter()); 193 } catch(java.io.IOException e) 194 { 195 throw new JspException("IO Error: " + e.getMessage()); 196 } 197 return EVAL_PAGE; 198 } 199 200 } 201 | Popular Tags |