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
samrat.1985@lntinfotechsamrat.1985@lntinfotech 

Fetch page name from controller of other page in VIsualForce

HI All,

 

I have a Calculate Page which calculates some data when inculded in another Page and adds it to a custom object.

 

I want the controller of the Calculate Page to be able to capture the page names of the Pages it is included in.

 

For example . Calculate Page is included using apex:include in Samrat Page then my Calculate Page controller class should be able to display 

 

Page Name:Samrat Page

 

Is there a way to do that, as using page reference i am able to get Page Name as Calculate Page everytime as the controller is used in this page. But how can i enhance it to capture The Includee page name.

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

Can you derive it from the URL - if you execute:

 

Str urlStr=ApexPages.currentPage().getURL();

 That will give you the relative URL that was requested - In your case I'd expect it to be something like:

 

/apex/Samrat<?param=value&param2=value>

(the parameters in angled brackets are optional you haven't mentioned if you have any) which you can then parse to extract the actual page name.

 

 

All Answers

bob_buzzardbob_buzzard

Can you derive it from the URL - if you execute:

 

Str urlStr=ApexPages.currentPage().getURL();

 That will give you the relative URL that was requested - In your case I'd expect it to be something like:

 

/apex/Samrat<?param=value&param2=value>

(the parameters in angled brackets are optional you haven't mentioned if you have any) which you can then parse to extract the actual page name.

 

 

This was selected as the best answer
samrat.1985@lntinfotechsamrat.1985@lntinfotech

Yes i tried the same thing too.

But thanks for you reply.