Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Attributes are name and value pairs, in which value are of type Java.lang.object.  It means any java object can be an attribute value, because any java class extends from Java.lang.object.  Attributes are used to move data from one part of the web application to another.  It basically refers to a servlet or jsp providing data to another servlet or jsp. 
The servlet API allows both setter and getter methods for attributes, unlike parameters which have only getter methods.  Attributes are of 3 types. 
1)      Request attributes

2)      Session attributes

3)      Context attributes 
These 3 attributes can be get or set by using the following objects respectively. 
1)      Javax.servlet.ServletRequest

2)      Javax.servlet.Http.HttpSession

3)      Javax.servlet.ServletContext 
The following methods are present in the above 3 objects, which can be used to get or set attributes. 
1)      void setAttribute(String name, Object value)

2)      object getAttribute(String name)

3)      Enumeration getAttributeNames()

4)      Void removeAttribute(String name)

  • No labels