You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by ca...@apache.org on 2002/01/09 21:28:33 UTC
cvs commit: jakarta-taglibs/mailer/src/org/apache/taglibs/mailer AddRecipientTag.java
catlett 02/01/09 12:28:33
Modified: mailer/src/org/apache/taglibs/mailer AddRecipientTag.java
Log:
this update fixes a bug that caused addresses to not get set if they were set using the address attribute
Revision Changes Path
1.2 +65 -43 jakarta-taglibs/mailer/src/org/apache/taglibs/mailer/AddRecipientTag.java
Index: AddRecipientTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/mailer/src/org/apache/taglibs/mailer/AddRecipientTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AddRecipientTag.java 14 Aug 2001 00:02:23 -0000 1.1
+++ AddRecipientTag.java 9 Jan 2002 20:28:33 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/mailer/src/org/apache/taglibs/mailer/AddRecipientTag.java,v 1.1 2001/08/14 00:02:23 catlett Exp $
- * $Revision: 1.1 $
- * $Date: 2001/08/14 00:02:23 $
+ * $Header: /home/cvs/jakarta-taglibs/mailer/src/org/apache/taglibs/mailer/AddRecipientTag.java,v 1.2 2002/01/09 20:28:33 catlett Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/01/09 20:28:33 $
*
* ====================================================================
*
@@ -92,7 +92,7 @@
* </attribute>
* </tag>
*
- * @author Jayson Falkner Rich Catlett
+ * @author Rich Catlett Jayson Falkner
*
* @version 1.0
*
@@ -108,60 +108,82 @@
* The address to be added
*/
private String address = null;
+ /**
+ * The parent tag of this tag
+ */
+ MailTag myparent = null;
/**
* implementation of the method from the tag interface that tells the JSP
- * page what to do after the body of this tag
+ * page what to do at the start of this tag
*
* @throws JSPException thrown when an error occurs while processing the
* body of this method
*
* @return SKIP_BODY int telling the tag handler to not evaluate the body
- * of this tag again
+ * of this tag
+ * EVAL_BODY_TAG int telling the tag handler to evaluate the body
+ * of this tag
*
*/
- public final int doAfterBody() throws JspException {
-
+ public final int doStartTag() throws JspException {
// parent tag must be a MailTag, gives access to methods in parent
- MailTag myparent = (MailTag)javax.servlet.jsp.tagext.TagSupport.findAncestorWithClass(this, MailTag.class);
+ myparent = (MailTag)javax.servlet.jsp.tagext.TagSupport.findAncestorWithClass(this, MailTag.class);
if (myparent == null)
throw new JspException("addrecipient tag not nested within mail tag");
- else {
- // Make sure type is set..either "to", "cc", or "bcc"
- if ((type != null) && (type.equalsIgnoreCase("to") ||
+ // Make sure type is set..either "to", "cc", or "bcc"
+ if ((type != null) && (type.equalsIgnoreCase("to") ||
type.equalsIgnoreCase("cc") || type.equalsIgnoreCase("bcc"))) {
- if (address != null) {
- // Try to see if the address attribute was used.
- if (type.equalsIgnoreCase("to"))
- // set to in the parent tag
- myparent.addTo(address);
- if (type.equalsIgnoreCase("cc"))
- // set cc in the parent tag
- myparent.addCc(address);
- if (type.equalsIgnoreCase("bcc"))
- // set bcc in the parent tag
- myparent.addBcc(address);
- } else if ((address = bodyContent.getString()) != null) {
- // Try to see if the body was used for the address.
- if (type.equalsIgnoreCase("to"))
- // set to in the parent tag
- myparent.addTo(address);
- if (type.equalsIgnoreCase("cc"))
- // set cc in the parent tag
- myparent.addCc(address);
- if (type.equalsIgnoreCase("bcc"))
- // set bcc in the parent tag
- myparent.addBcc(address);
- } else
- throw new JspException("Address was not found. set " +
+
+ if (address != null) {
+ // Try to see if the address attribute was used.
+ if (type.equalsIgnoreCase("to"))
+ // set to in the parent tag
+ myparent.addTo(address);
+ if (type.equalsIgnoreCase("cc"))
+ // set cc in the parent tag
+ myparent.addCc(address);
+ if (type.equalsIgnoreCase("bcc"))
+ // set bcc in the parent tag
+ myparent.addBcc(address);
+ return SKIP_BODY;
+ } else
+ return EVAL_BODY_TAG;
+ } else
+ throw new JspException("The type attribute is not set. " +
+ " Specify either \"to\", \"cc\", or \"bcc\".");
+ }
+
+
+ /**
+ * implementation of the method from the tag interface that tells the JSP
+ * page what to do after the body of this tag
+ *
+ * @throws JSPException thrown when an error occurs while processing the
+ * body of this method
+ *
+ * @return SKIP_BODY int telling the tag handler to not evaluate the body
+ * of this tag again
+ *
+ */
+ public final int doAfterBody() throws JspException {
+ if ((address = bodyContent.getString()) != null) {
+ // Try to see if the body was used for the address.
+ if (type.equalsIgnoreCase("to"))
+ // set to in the parent tag
+ myparent.addTo(address);
+ if (type.equalsIgnoreCase("cc"))
+ // set cc in the parent tag
+ myparent.addCc(address);
+ if (type.equalsIgnoreCase("bcc"))
+ // set bcc in the parent tag
+ myparent.addBcc(address);
+ return SKIP_BODY;
+ } else
+ throw new JspException("Address was not found. set " +
" the address attribute, or place the address in" +
" the body of the tag.");
- } else
- throw new JspException("The type attribute is not set. " +
- " Specify either \"to\", \"cc\", or \"bcc\".");
- }
- return SKIP_BODY;
}
/**
@@ -172,7 +194,7 @@
*
*/
public final void setType(String type) {
- this.type = type;
+ this.type = type.trim();
}
/**
@@ -183,6 +205,6 @@
*
*/
public final void setAddress(String address) {
- this.address = address;
+ this.address = address.trim();
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>