BBjspWebSession::removeAttribute


Description

In BBj 16.0 and higher, this method removes the object bound with the specified name from this session.

Syntax

Return Value

Method

void

removeAttribute(string name)

Parameters

Variable

Description

name

name of attribute to remove

Return Value

None.

Remarks

Removes the object bound with the specified name from this BBjspWebSession. The example below shows removing the attribute called ‘MyAttribute’ from the session within a BBJSP BBJSP Servlet.

Example

This example demonstrates how this works in a BBJSP web-page

<html>
    <body>
        <h1>Hello from BBJSP</h1>
        <%
            #getSession().removeAttribute("MyAttribute")
        %>
    </body>
</html>

This example demonstrates how this works in a BBJSP servlet

class public MyServlet

  field private BBjspWebRequest request!
  field private BBjspWebResponse response!
  field private BBjspWebSession session!
  
  method public void service(BBjspServletContext context!)
       
    #request! = context!.getRequest()
    #response! = context!.getResponse()

    #session! = #request!.getSession()
    s! = #response!.getOutputStream()
    
    #response!.setContentType("text/html")
    
    session!.removeAttribute("MyAttribute")
    s!.write("<html><body><h1>Hello from BBJSP</h1>")
    s!.write("</body></html>")
  methodend
classend

See Also

BBjspWebSession