Say you want to create a global variable to store a public key with a value of "1234xyz". Just create a new Custom Label with Name = "Global_PublicKey" and Value="1234xyz"
So in Apex you just reference the value as Label.Global_PublicKey:
private boolean isAuthorized(){
String qPublickKey = ApexPages.currentPage().getParameters().get('publicKey');
return qPublickKey.contains(Label.Global_PublicKey);
}
In a VisualForce page you refence it {!$Label.Global_PublicKey}:
<apex:page showheader="false" sidebar="false">
<apex:pageblock title="Test">
Global Variable PublicKey = {!$Label.Global_PublicKey}
</apex:pageblock>
</apex:page>
No comments:
Post a Comment