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 gl...@locus.apache.org on 2000/11/06 14:55:14 UTC

cvs commit: jakarta-taglibs/regexp/src/org/apache/taglibs/regexp TextTag.java

glenn       00/11/06 05:55:14

  Modified:    regexp/src/org/apache/taglibs/regexp TextTag.java
  Log:
  Cleanup for release
  
  Revision  Changes    Path
  1.2       +10 -14    jakarta-taglibs/regexp/src/org/apache/taglibs/regexp/TextTag.java
  
  Index: TextTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/regexp/src/org/apache/taglibs/regexp/TextTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TextTag.java	2000/10/22 01:32:04	1.1
  +++ TextTag.java	2000/11/06 13:55:13	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-taglibs/regexp/src/org/apache/taglibs/regexp/TextTag.java,v 1.1 2000/10/22 01:32:04 glenn Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/10/22 01:32:04 $
  + * $Header: /home/cvs/jakarta-taglibs/regexp/src/org/apache/taglibs/regexp/TextTag.java,v 1.2 2000/11/06 13:55:13 glenn Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/11/06 13:55:13 $
    *
    * ====================================================================
    *
  @@ -68,8 +68,8 @@
   import javax.servlet.jsp.tagext.*;
   
   /**
  - * JSP Tag <b>text</b>, used to define the text that a
  - * regexp will be used on.
  + * JSP Tag <b>text</b>, used to create a script variable for the
  + * text that a regexp will be used on.
    * <p>
    * The body of the tag is used as the text for a regular expression.
    * <p>
  @@ -78,7 +78,7 @@
    * &lt;name&gt;regexp&lt;/name&gt;
    * &lt;tagclass&gt;org.apache.taglibs.regexp.TextTag&lt;/tagclass&gt;
    * &lt;bodycontent&gt;JSP&lt;/bodycontent&gt;
  - * &lt;info&gt;Used to create a script variable for a text string for use with a regular expression.&lt;/info&gt;
  + * &lt;info&gt;Create a script variable for a text string for use with a regular expression.&lt;/info&gt;
    *   &lt;attribute&gt;
    *     &lt;name&gt;id&lt;/name&gt;
    *     &lt;required&gt;true&lt;/required&gt;
  @@ -86,20 +86,20 @@
    *   &lt;/attribute&gt;
    * </pre>
    *
  + * @see TextData
  + *
    * @author Glenn Nielsen
    */
   
   public class TextTag extends BodyTagSupport
   {
  -    // A text string for later use with a regexp
  -    private String text = null;
   
       /**
        * Returns EVAL_BODY_TAG so the body of the tag can be evaluated.
        *
        * @return EVAL_BODY_TAG
        */
  -    public int doStartTag() throws JspException
  +    public final int doStartTag() throws JspException
       {
   	return EVAL_BODY_TAG;
       }
  @@ -110,11 +110,11 @@
        *
        * @return SKIP_BODY
        */
  -    public int doAfterBody() throws JspException
  +    public final int doAfterBody() throws JspException
       {
   	// Use the body of the tag as regular expression
   	BodyContent body = getBodyContent();
  -	text = body.getString();
  +	String text = body.getString();
   	// Clear the body since we only used it as input as the
   	// text string for a regular expression
   	body.clearBody();
  @@ -124,13 +124,9 @@
   	    throw new JspException(
   		"regexp tag text could not find a text string in body of tag.");
   
  -	pageContext.setAttribute(id,this,PageContext.PAGE_SCOPE);
  +	TextData td = new TextData(text);
  +	pageContext.setAttribute(id,td,PageContext.PAGE_SCOPE);
   	return SKIP_BODY;
  -    }
  -
  -    public String getText()
  -    {
  -	return text;
       }
   
   }