You need to sign in to do that
Don't have an account?
If i have two apex classes
Hi Team,
Can someone tell me how to identify/rectify if i have two classes one is custom controller and other one is controller extension on what base we can decide its custom controller and controller extension..
Thanks
Vijay S
Can someone tell me how to identify/rectify if i have two classes one is custom controller and other one is controller extension on what base we can decide its custom controller and controller extension..
Thanks
Vijay S
The extension class required to implement a constructor that accepts the type of the controller(ApexPages.StandardController). You will then typically want to get a handle to the standard controller instance that is floating around, and the sObject instance that it represents.
i.e,
The extension structure is like this
All Answers
The extension class required to implement a constructor that accepts the type of the controller(ApexPages.StandardController). You will then typically want to get a handle to the standard controller instance that is floating around, and the sObject instance that it represents.
i.e,
The extension structure is like this
What Ram told it is almost correct .This example he has given if you have standard controller and you have added extension to that .
As your controller is standard controller your concructor should contain the argument of standard controller .
and the format will be as belwo always
Same way if you have controller as a custom class and extension is also a custom apex class .Then the extension should contain an argument of the controller class in constructor like below. So now concept is your controller should not have any constuctor with argument of any class .
However your extension always have one argument constructor of your controller class .
I think you are clear now .
Let us know if it helps !!
Thanks
Manoj
1) It is an Apex class that implements all of the logic for a page without leveraging a standard controller.
2) You can use only one Apex class.
3) You can Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.
Extension:
1) A controller extension is any Apex class containing a constructor that takes a single argument of type ApexPages
2) It provides additional functionality to a controller – either a standard controller or a custom controller.
3) You can use multiple Apex classes separated by comma.
4) Use controller extensions when:You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete.You want to add new actions.You want to build a Visualforce page that respects user permissions. Although a controller extension class executes in system mode, if a controller extension extends a standard controller, the logic from the standard controller does not execute in system mode. Instead, it executes in user mode, in which permissions, field-level security, and sharing rules of the current user apply
Please check below post for more detail
http://www.salesforcetutorial.com/custom-controllers-controller-extensions/
Please let us know if this will help you