BBjServletData::setCallback

 

Description

In BBj 12.0 and higher, this method registers a custom object as a callback handler.

Syntax

Return Value

Method

void

setCallback(int eventType, CustomObject customObj, string methodName)

void

setCallback(int eventType, string subroutineName)

Parameters

Variable

Description

eventType

Event type to clear (ON_WEB_CONNECTION) for which the callback is to be registered.

customObj

A custom object containing the method to be called when the event is processed by process_events.

methodName

The name of the method that is to be called when the event is processed by processEvents.

SubroutineName

Subroutine name to be executed in PROCESS_EVENTS.

Return Value

None.

Remarks

None.

Example

MyServlet! = new MyServlet()

data! = BBjAPI().getServletData()

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

PROCESS_EVENTS

class public MyServlet
  method public void myMethod(BBjServletEvent p_event!)
      LET chan = UNT
      open(chan)"JSERVLET"

      print(chan)"<html><body>"
      print(chan)"Hello BBj World!"
      print(chan)"</body></html>"
      close(chan)
  methodend
classend

See Also

BBjAPI

BBjServletData.