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 139 140 public class CurrentDepthTag extends TagSupport 141 { 142 private WalkTag wt = null; 143 private int thread_depth = 0; 144 145 150 public final int doStartTag() throws JspException 151 { 152 try { 153 wt = (WalkTag)this.findAncestorWithClass(this, 154 Class.forName("com.Yasna.forum.tags.WalkTag")); 155 } catch(Exception e) { 156 return SKIP_BODY; 157 } 158 159 thread_depth = wt.getDepth(); 160 return SKIP_BODY; 161 } 162 163 168 public final int doEndTag() throws JspException 169 { 170 try { 171 pageContext.getOut().write("" + thread_depth); 172 } catch(Exception e) { 173 throw new JspException("IO Error: " + e.getMessage()); 174 } 175 return EVAL_PAGE; 176 } 177 178 } 179 | Popular Tags |