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 141 142 public class SetParentMessageTag extends BodyTagSupport 143 { 144 145 150 public final int doStartTag() throws JspException 151 { 152 return EVAL_BODY_TAG; 153 } 154 155 161 public final int doAfterBody() throws JspException 162 { 163 BodyContent body = getBodyContent(); 165 String s = body.getString(); 166 body.clearBody(); 168 169 int mid = 0; 170 try { 171 mid = Integer.valueOf(s).intValue(); 172 } catch(NumberFormatException e) { 173 throw new JspException( 174 "Jive set_parent_message tag, body of tag is not a parent messageID integer"); 175 } 176 177 ThreadTag tt = null; 179 try { 180 tt = (ThreadTag)this.findAncestorWithClass(this, 181 Class.forName("com.Yasna.forum.tags.ThreadTag")); 182 } catch(Exception e) { 183 } 184 185 if( tt == null ) { 187 throw new JspException( 188 "Jive set_parent_message tag must be nested inside a thread tag"); 189 } 190 tt.setParentMessage(mid); 191 192 return SKIP_BODY; 193 } 194 195 } 196 | Popular Tags |