1 16 17 package org.apache.taglibs.mailer; 18 19 import javax.servlet.jsp.JspException ; 20 import javax.servlet.jsp.tagext.BodyContent ; 21 import javax.servlet.jsp.tagext.BodyTagSupport ; 22 23 38 39 public class FromTag extends BodyTagSupport { 40 41 42 53 public int doAfterBody() throws JspException { 54 55 MailTag myparent = (MailTag)findAncestorWithClass(this, MailTag.class); 57 58 if (myparent == null) { 59 throw new JspException ("from tag not nested within mail tag"); 60 } 61 62 BodyContent body = getBodyContent(); 63 String from = body.getString(); 64 body.clearBody(); 66 if (from != null) { 67 from.trim(); 68 if (from.length() > 0) { 69 myparent.resetFrom(from); return SKIP_BODY; 71 } 72 } 73 throw new JspException ("The from tag is empty"); 74 } 75 } 76 | Popular Tags |