Skip to Content
0
Oct 17, 2005 at 07:40 AM

When do subcontroller classes die?

28 Views

I have a question concerning the lifetime of controller class instances.

I have a view called root.bsp, where I create one out of two subcontrollers depending on a variable.

<% IF controller->myVar = 1.%>
    <bsp:call url="c1.do" comp_id = "c1" />
<% ELSE. %>
    <bsp:call url="c2.do" comp_id = "c2" />
<% ENDIF.%>

c1.do has a controller class called CL_1.

At first, myVar is 1, so c1 is called. Now, in CL_1 I set myVar to 2, so in the next request, c2 will be called. I would assume that the instance of CL_1 now will be destroyed because it is not used anymore. However, when I call c1.do later, CL_1 will still have the attribute values from the previous time.

Why is the controller class instance not removed after the corresponding controller/view is not shown anymore?