You need to sign in to do that
Don't have an account?
Swati.dhingra
Message Edited by Swati.dhingra on 06-10-2008 05:30 AM
visualforce
hi
I m trying to make a custom controller, for that i am creating a apex class.
For this i have taken the following code from developer's guide, but i m getting an error .
public class MyController { public PageReference save() { return null; } public String getName() { return 'MyController'; } public Account getAccount() { return [select id, name from Account where id = :ApexPages.currentPage().getParameters().get('id')]; } }
Error message :
Compile Error: Method does not exist or incorrect signature: ApexPages.currentPage() at line 13 column 30 |
Help me to resolve the error.
Thanks in advance
Swati
Message Edited by Swati.dhingra on 06-10-2008 05:30 AM
The error your getting relates to this line
Which should be:
Also it doesn't look like you have a constructor defined which you should. Hope this helps.
Message Edited by Scott.M on 06-10-2008 08:49 AM
You do not have to define a constructor unless you are using an Apex controller as an extension, or unless you want to execute any code in the constructor of your class. A default constructor is implied.
Is there any reason you would want to load an object in the constructor like in the Summer 08 example and store it in a private final variable vs having the DML statement in the getAccount() function?