Skip to Content
author's profile photo Former Member
Former Member

Controllers and Subcontrollers - how to set hierarchy?

This may be a stupid question, but... how do you set up a hierarchy of controllers and subcontrollers? I know that the top controller has a blank COMPONENT_ID (according to the code), but where do we specify this when creating a controller? And a subcontroller can have subcontrollers of its own (I think) - what would indicate the top controller in that situation?

Where is all this set? By the time my debugging session kicks in (DO_REQUEST of top controller) the table M_SUBCONTROLLERS has already been set up. I have followed the logic back to the adapter object, and the page object, then I start to get stuck, partly because I don't know what these objects are really for.

It would be nice to know what mysterious entity controls the controller class - calling the methods of that class such as DO_INIT, DO_REQUEST for example.

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Oct 23, 2003 at 05:27 PM

    Hi Paul,

    The hierarchy is set automatically. If you create a controller (either with method "CREATE_CONTROLLER" or implicitely via <bsp:call > in the view belonging to your current controller, the new controller alway become a child of the current controller.

    If your BSP application is stateful and you pass an id on creating the new controller, this created controller will live until the parent controller is destroyed, or until you delete the subcontroller explicitely.

    Otherwise the sub-controller lives only for this request.

    There are some methods that you should know:

    1. DO_INIT is a kind of "constructor", which means that it is called on creation of a controller

    2. DO_REQUEST is called for each request either via "CALL_CONTROLLER" of via <bsp:call >.

    3. The input handling must be triggered with the call of "DISPATCH_INPUT()", which must be done in the DO_REQUEST-method of the main controller. This calls the methods DO_HANDLE_DATA of each active controller, DO_HANDLE_EVENT of the controller responsible for the control that triggered the event, and DO_FINISH_INPUT of all active controllers. These methods should handle the complete input.

    Regards, Regina

    Add comment
    10|10000 characters needed characters exceeded