ads

Tuesday, 28 August 2018

To get current Path: ApexPages.currentPage().getUrl()

Code Format:


Visualforce page:
<apex:page controller="Path">
    <apex:form >
        <apex:pageBlock >
            Current URL is {!currURL}
        </apex:pageBlock>
    </apex:form>
</apex:page>

Apex Class:
public with sharing class Path {
    
    public String currURL {get;set;}
    
    public Path() {
        currURL = ApexPages.currentPage().getUrl();
    }
        
}

Output:


No comments:

Post a Comment