You need to sign in to do that
Don't have an account?
mikefitz
Currentpage Name?
Does anyone know how to get the currentpage name as in the Visualforce Name in Apex?
PageReference pageRef = ApexPages.currentPage(); doesn't give me the name without writing code to pull it out.
I simple need a way to grab the name so I can set the title and content dynamically through an object.
My only work around would be writing the pageref to the object but when I write to the field I get and error: Invalid bind expression type of System.PageReference for column of type String.
Please help asap.
Gracias
Try the code given below :
{!$CurrentPage.Name}
This will acceess the name of current page.
Did this answer your question? if so, please mark it solved.
I need it in Apex not Visualforce.
In my opinion, you can not get current page name by any apex page method.
Try this out by using string split method :
String strurl = ApexPages.currentPage().getUrl();
String strurl = strurl.split('apex/')[1];
Hope this helps.
This helped me too! Quick and easy.
Thanks, Predeep_Navatar!