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