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/10/30 00:02:02 UTC

cvs commit: jakarta-taglibs/session/src/org/apache/taglibs/session ExistsAttributeTag.java

glenn       00/10/29 15:02:02

  Modified:    session/src/org/apache/taglibs/session
                        ExistsAttributeTag.java
  Log:
  Cleanup for release
  
  Revision  Changes    Path
  1.2       +21 -6     jakarta-taglibs/session/src/org/apache/taglibs/session/ExistsAttributeTag.java
  
  Index: ExistsAttributeTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/session/src/org/apache/taglibs/session/ExistsAttributeTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExistsAttributeTag.java	2000/09/24 03:25:38	1.1
  +++ ExistsAttributeTag.java	2000/10/29 23:02:02	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-taglibs/session/src/org/apache/taglibs/session/ExistsAttributeTag.java,v 1.1 2000/09/24 03:25:38 glenn Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/09/24 03:25:38 $
  + * $Header: /home/cvs/jakarta-taglibs/session/src/org/apache/taglibs/session/ExistsAttributeTag.java,v 1.2 2000/10/29 23:02:02 glenn Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/10/29 23:02:02 $
    *
    * ====================================================================
    *
  @@ -100,7 +100,9 @@
   
   public class ExistsAttributeTag extends TagSupport
   {
  +    // Name of session attribute
       private String name = null;
  +    // Value that existsattribute must match
       private Boolean value = null;
   
       /**
  @@ -108,9 +110,11 @@
        *
        * @return SKIP_BODY if existsattribute doesn't match value, EVAL_BODY_include if existsattribute matches value
        */
  -    public int doStartTag() throws JspException
  +    public final int doStartTag() throws JspException
       {
   	boolean result = false;
  +
  +	// Try to get the session attribute
   	if( pageContext.getSession().getAttribute(name) != null )
   	    result = true;
   
  @@ -119,17 +123,28 @@
   		return EVAL_BODY_INCLUDE;
   	   return SKIP_BODY;
   	}
  +
   	if( value.booleanValue() == result )
   	    return EVAL_BODY_INCLUDE;
   	return SKIP_BODY;
       }
   
  -    public void setName(String str)
  +    /**
  +     * Set the required tag attribute <b>name</b>.
  +     *
  +     * @param String name of session attribute
  +     */
  +    public final void setName(String str)
       {   
   	name = str;
       }
   
  -    public void setValue(String str)
  +    /**
  +     * Set the optional tag attribute <b>value</b> to true or false.
  +     *
  +     * @param String true or false
  +     */
  +    public final void setValue(String str)
       {
   	value = new Boolean(str);
       }