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 39 40 public class PasswordTag extends BodyTagSupport { 41 42 43 54 public int doAfterBody() throws JspException { 55 56 MailTag myparent = (MailTag)findAncestorWithClass(this, MailTag.class); 58 59 if (myparent == null) { 60 throw new JspException ("from tag not nested within mail tag"); 61 } 62 63 BodyContent body = getBodyContent(); 64 String password = body.getString(); 65 body.clearBody(); 67 if (password != null) { 68 password.trim(); 69 if (password.length() > 0) { 70 myparent.setPassword(password); return SKIP_BODY; 72 } 73 } 74 throw new JspException ("The from tag is empty"); 75 } 76 } 77 | Popular Tags |