on 10-17-2005 8:40 AM
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?
This has nothing to do whether a controller is used (shown, for the view) or not, but simply if the application is stateless or stateful.
Are you using a stateful application?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel,
have a look at the methods of class CL_BSP_CONTROLLER2, there's a method called delete_controller (that's the asnwer to your how-question). You should know by yourself when you want to call it. I don't know the circumstances.
Regards,
Rainer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel
Since your application is stateless i'd assume your subcontroller dies with page change (Check Controller method set_lifetime).
Did u try give both controllers the same comp_id? They may overwrite each other this way...
Cheers
Daniel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But then, what's the purpose of specifying the lifetime of the controller. You can chose between "session", "request" or "until page change". I selected the third and I assumed that a page change occured when root.bsp displayed the other controller. But that'S probably not considered a page change, right?
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.