BBjServletData::setCallback (Deprecated)

BBjServlets are deprecated for BBj 21.00 and higher, and have been replaced by BBxServlets.

Description

In BBj 12.00 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, Object object, 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 PROCESS_EVENTS.

object

A Java object containing the method to be called when the event is processed by PROCESS_EVENTS.

SubroutineName

Subroutine name to be executed in PROCESS_EVENTS.

Return Value

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

ClosedVersion History

  • 25.03: Previously, this method could only accept a BBj CustomObject, but can now take any Java Object as a parameter.

See Also

BBjAPI

BBjServletData.