org.apache.taglibs.response
Class AddCookieTag

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--org.apache.taglibs.response.AddCookieTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class AddCookieTag
extends javax.servlet.jsp.tagext.TagSupport

JSP Tag addCookie, used to add a cookie to the Http Response.

The script variable for the name of the cookie is required.

Cookie attributes such as the comment, value, etc. can be set statically by using the corresponding addCookie tag attribute. Or dynamically using the corresponding tag in the body of the addCookie tag.

JSP Tag Lib Descriptor

 <name>addCookie</name>
 <tagclass>org.apache.taglibs.response.AddCookieTag</tagclass>
 <bodycontent>JSP</bodycontent>
 <info>Add a cookie to an Http Response.</info>
   <attribute>
     <name>name</name>
     <required>true</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>value</name>
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>comment</name>    
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>domain</name>    
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>maxAge</name>    
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>path</name>    
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>secure</name>    
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>version</name>    
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
 

Author:
Glenn Nielsen
See Also:
Serialized Form

Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
AddCookieTag()
           
 
Method Summary
 int doEndTag()
          Method called at end of Tag used to set cookie attributes and add the cookie to the Http Response.
 int doStartTag()
          Method called at start of addCookie tag to create cookie
 void setComment(java.lang.String com)
          Optional attribute, specifies a comment that describes a cookie's purpose.
 void setDomain(java.lang.String dom)
          Optional attribute, specifies the domain within which this cookie should be presented.
 void setMaxAge(int max)
          Optional attribute, sets the maximum age of the cookie in seconds.
 void setName(java.lang.String nam)
          Required attribute, name of the cookie.
 void setPath(java.lang.String pth)
          Optional attribute, specifies a path for the cookie to which the client should return the cookie.
 void setSecure(boolean flag)
          Optional attribute, indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL.
 void setValue(java.lang.String val)
          Optional attribute, assigns a value to a cookie.
 void setVersion(int version)
          Optional attribute, sets the version of the cookie protocol this cookie complies with.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddCookieTag

public AddCookieTag()
Method Detail

doStartTag

public final int doStartTag()
                     throws javax.servlet.jsp.JspException
Method called at start of addCookie tag to create cookie
Overrides:
doStartTag in class javax.servlet.jsp.tagext.TagSupport
Returns:
EVAL_BODY_INCLUDE

doEndTag

public final int doEndTag()
                   throws javax.servlet.jsp.JspException
Method called at end of Tag used to set cookie attributes and add the cookie to the Http Response.
Overrides:
doEndTag in class javax.servlet.jsp.tagext.TagSupport
Returns:
EVAL_PAGE

setComment

public final void setComment(java.lang.String com)
Optional attribute, specifies a comment that describes a cookie's purpose.
Parameters:
String - comment

setDomain

public final void setDomain(java.lang.String dom)
Optional attribute, specifies the domain within which this cookie should be presented.
Parameters:
String - domain

setMaxAge

public final void setMaxAge(int max)
Optional attribute, sets the maximum age of the cookie in seconds.
Parameters:
String - number of seconds

setName

public final void setName(java.lang.String nam)
Required attribute, name of the cookie.
Parameters:
String - name

setPath

public final void setPath(java.lang.String pth)
Optional attribute, specifies a path for the cookie to which the client should return the cookie.
Parameters:
String - path

setValue

public final void setValue(java.lang.String val)
Optional attribute, assigns a value to a cookie.
Parameters:
String - value

setSecure

public final void setSecure(boolean flag)
Optional attribute, indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL. Set to true or false. Default value is false.
Parameters:
String - true or false

setVersion

public final void setVersion(int version)
Optional attribute, sets the version of the cookie protocol this cookie complies with.
Parameters:
int - version number


Copyright ? 2000 Apache Software Foundation. All Rights Reserved.