function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdcksfdck 

Confusion with ApexPages

     Hi,

 

     I have a confusion in these lines about the ApexPages 

 

      ApexPages.currentPage().getParameters().get('id') --->  wt is ApexPages in this line ?

 

     Apexpages.standardcontroller ---> wt is Apexpages here ?

 

 

   Help is greatly Appreciated.

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
kreshokresho

ApexPages is a static reference to the ApexPages class. See documentation on the ApexPages class at http://www.salesforce.com/us/developer/docs/pages/Content/apex_methods_system_apexpages.htm

 

Interestingly, the currentPage() method is not listed here.

 

ApexPages.StandardController is a static reference to the StandardController class that is an inner class in the ApexPages class. Documentation for it is at http://www.salesforce.com/us/developer/docs/pages/Content/apex_pages_standardcontroller.htm

 

Regards,

Kresimir

Apex Editor LS - free alternative to Force.com apex editor.

All Answers

souvik9086souvik9086

Hi,

 

       ApexPages.currentPage().getParameters().get('id')

The getAccount method uses an embedded SOQL query to return the account specified by the id parameter in the URL of the page. To access id, the getAccount method uses the ApexPages namespace:

  • First the currentPage method returns the PageReference instance for the current page. PageReference returns a reference to a Visualforce page, including its query string parameters.
  • Using the page reference, use the getParameters method to return a map of the specified query string parameter names and values.
  • Then a call to the get method specifying id returns the value of the id parameter itself.
    ApexPages here means it refers for the current page with the currentPage ApexPages method.

    Apexpages.standardcontroller:
  • The only time it is necessary to refer to a StandardController object is when defining an extension for a standard controller. Here ApexPages means A controller extension is any Apex class containing a constructor that takes a single argument of type ApexPages.StandardController.  The extension is associated with the page using the extensions attribute of the <apex:page> component.

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

 

kreshokresho

ApexPages is a static reference to the ApexPages class. See documentation on the ApexPages class at http://www.salesforce.com/us/developer/docs/pages/Content/apex_methods_system_apexpages.htm

 

Interestingly, the currentPage() method is not listed here.

 

ApexPages.StandardController is a static reference to the StandardController class that is an inner class in the ApexPages class. Documentation for it is at http://www.salesforce.com/us/developer/docs/pages/Content/apex_pages_standardcontroller.htm

 

Regards,

Kresimir

Apex Editor LS - free alternative to Force.com apex editor.

This was selected as the best answer