BBjHttpRequest::setAttribute (Deprecated)

BBjHttpRequest::setAttribute is deprecated for BBj 21.00 and higher, and has been replaced by BBxServletRequest::setAttribute.

Description

In BBj 15.00 and higher, this method stores an attribute in this request. Attributes are reset between requests. This method is most often used in conjunction with BBjHttpResponse::sendRedirect.

Attribute names should follow the same conventions as package names. If the object passed in is null(), the effect is the same as calling BBjHttpRequest::removeAttribute(String).

Syntax

Return Value

Method

void

setAttribute(string name, Object value)

Parameters

Parameter

Description

name

A String specifying the name of the attribute.

value

The Object to be stored.

Return Value

None.

Remarks

None.

Example

rem 'Obtain the instance of the BBjAPI object

let myAPI! = BBjAPI()
MyServlet! = new MyServlet()

data!.setCallback(data!.ON_WEB_CONNECTION, myServlet!, "myMethod")

process_events

class public MyServlet
    method public void myMethod(BBjServletEvent p_event!)
        let chan = UNT
        request! = p_event!.getHttpRequest()
        response! = p_event!.getHttpResponse()
        resp!.setContentType("text/html")
        open (chan)"JSERVLET"
        print (chan)"<html><body><h1>Hello BBj!</h1>"

        request!.setAttribute("myAttribute","the value")
        print (chan)"</body></html>"
        close (chan)
    methodend
classend