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 UserTag 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 user = body.getString(); 64 body.clearBody(); 66 if (user != null) { 67 user.trim(); 68 if (user.length() > 0) { 69 myparent.setUser(user); return SKIP_BODY; 71 } 72 } 73 throw new JspException ("The user tag is empty"); 74 } 75 } 76 | Popular Tags |