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 45 public class PortTag extends BodyTagSupport { 46 47 48 59 public int doAfterBody() throws JspException { 60 61 MailTag myparent = (MailTag)findAncestorWithClass(this, MailTag.class); 63 64 if (myparent == null) { 65 throw new JspException ("port tag not nested within mail tag"); 66 } 67 68 BodyContent body = getBodyContent(); 69 String port = body.getString(); 70 body.clearBody(); 72 if (port != null) { 73 port.trim(); 74 if (port.length() > 0) { 75 myparent.resetPort(port); return SKIP_BODY; 77 } 78 } 79 throw new JspException ("The port tag is empty"); 80 } 81 } 82 | Popular Tags |