Skip to Content
0
Former Member
Aug 16, 2005 at 12:08 PM

MVC: Storing a model in Application

13 Views

Hello again,

I just found fragments in here and the weblogs on how to store a model (derived from CL_BSP_MODEL) within the application.

To clear it up: I have a model class that shall be persistent to all controllers within the session scope (so, per user). My controllers have an attrribute called APPLICATION, being of type OBJECT. But many examples talk of the interface IF_BSP_APPLICATION which I cannot find within any of my controllers. The BSP app entry itself has no pinters to classes, just base porperties and navigation mappings, so where do I find this reference to IF_BSP_APPLICATION?

I could create a custom class to store my model, but where to create it? I have multiple controllers and want to go shure that another controller (not being a sub controller) receives the model. I have set all my ctonrollers as well as the app to session lifecycle.

It would be okay for me to pass the next controller my model, but navigation->set_parameter() cannot pass object references.

I would like to have something like this:

CTRLA:

application->set_attribute( name='model' value=me->model ).

CTRLB:

mod = application->get_attribute( name='model' ).

Where "application" is really one single instance per session for all controllers within the MVC app.

From Java I know this as request.getSession().setAttribute("model", model);

Thanks you,

Timo