BBjspSessionData::getAttribute (Deprecated)

The BBJSP system is deprecated. For new development, use BBxServlet.

Description

In BBj 16.0 and higher, this method returns the object bound with the specified name in this BBjspSessionData, or null if no object is bound under the name.

Syntax

Return Value

Method

Object

getAttribute(string name)

Parameters

Variable

Description

name

name of attribute to be retrieved

Return Value

the value bound to the name

Remarks

Example

This example demonstrates how this works in a BBJSP servlet

CLASS PUBLIC MyServlet

    REM ===
    REM === You must implement this method as it is the main execution point.
    REM ===
    METHOD PUBLIC void service(BBjspServletContext context!)
        
        declare BBjspWebRequest request!
        declare BBjspWebResponse response!
        declare BBjspSessionData data!
        
        request! = context!.getRequest()
        response! = context!.getResponse()
        data! = #context!.getBBjspSession()

        if !data!.contains("FOO") then
            data!.setAttribute("FOO","This is FOO")
        endif
    
        s! = response!.getOutputStream()
        s!.write("<html>")
        s!.write("<body>")
        s!.write("<html><body><h1>Hello from BBJSP</h1>")
        s!.write(data!.getAttribute("FOO"))
        s!.write("</body>")
        s!.write("</html>")
        
    METHODEND
    
CLASSEND

See Also

BBJSP