1 53 54 106 107 package com.Yasna.forum.tags; 108 109 import java.io.*; 110 import javax.servlet.*; 111 import javax.servlet.jsp.*; 112 import javax.servlet.jsp.tagext.*; 113 import javax.servlet.http.*; 114 import com.Yasna.forum.*; 115 import com.Yasna.forum.tags.*; 116 117 137 138 public class ChangeThreadTag extends BodyTagSupport 139 { 140 141 146 public final int doStartTag() throws JspException 147 { 148 return EVAL_BODY_TAG; 149 } 150 151 157 public final int doAfterBody() throws JspException 158 { 159 BodyContent body = getBodyContent(); 161 String s = body.getString(); 162 body.clearBody(); 164 165 int tid = 0; 166 try { 167 tid = Integer.valueOf(s).intValue(); 168 } catch(NumberFormatException e) { 169 throw new JspException( 170 "Jive change_thread tag, body of tag is not a threadID integer"); 171 } 172 173 ThreadTag tt = null; 175 try { 176 tt = (ThreadTag)this.findAncestorWithClass(this, 177 Class.forName("com.Yasna.forum.tags.ThreadTag")); 178 } catch(Exception e) { 179 } 180 181 if( tt == null ) { 183 throw new JspException( 184 "Jive change_thread tag must be nested inside a thread tag"); 185 } 186 tt.changeThread(tid); 187 188 return SKIP_BODY; 189 } 190 191 } 192 | Popular Tags |