cancel
Showing results for 
Search instead for 
Did you mean: 

what is the difference between custom controller and context controller?

Former Member
0 Kudos

Hi Gurus,

What is the difference between Custom and context controller?

In which occasion we should prefer to use Custom Controller?

Thanks in Advance,

Dharani

Accepted Solutions (1)

Accepted Solutions (1)

BGarcia
Active Contributor
0 Kudos

Hi Dharani,

A Context controller it's a view-orientated controller. It is responsible for the interaction between a view and a node of the MVC model. They normally are created when you access a view, and destroyed when you leave it.

A Custom controller it's like a global controller of the MVC model. They aren't associated with a view, and they are always present in memory to store MVC model data/information.

Kind regards.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Dharani,

Component Controller:-

The component controller is the master controller for a Web Dynpro component. As soon as you declare the existence of a Web Dynpro component, the component controller is automatically created. You cannot have a Web Dynpro component without a corresponding component controller.

This controller can be thought of as being hierarchically superior to all other controllers in the component. Consequently, the lifespan of the component is always equal to the lifespan of the component controller.

Custom Controllers:-

Custom controllers are similar to the component controller in that they too have no visual interface. However, the existence of custom controllers is controlled entirely by the Web Dynpro developer at design time. Declaring the existence of a Web Dynpro component causes the component controller to be created automatically, but this is not the case with custom controllers. Custom controllers are only created by an explicit design time declaration.

When should a custom controller be used?

Custom controllers should be created only when their presence will simplify the overall structure of the component. The principles to follow for deciding when a custom controller is needed are controlled by:

u2022 Reuse

Create a custom controller if you have identified a reuse case for a specific unit of code required by several other controllers within the component.

u2022 Task separation

To avoid placing too much coding in the component controller (and thereby potentially increasing its initialisation time), place coding dedicated to a specific task into a separate custom controller

While you can say Component controller is the default custom controller. And more over you can create as many custom controllers as you want for better maintenance.

regards,

Swati

PradeepBondla
Active Contributor
0 Kudos

Hi Dharani,

its been discussed many times.... just go through these threads, you will be clear

/thread/464134 [original link is broken]

why we need Custom controllers in Model Applications

PradeeP

your thread ( duplicated) /thread/973013 [original link is broken]