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
Kirill_YunussovKirill_Yunussov 

How to access a static "constant" variable from another class?

I have a class called Constants, which is full of various constants.   What is teh syntax of accessing one of them from a VF page?

 

Something like below.  The syntax below directs the page to the controller.  I need it to look in the Constants class instead.  

 

<apex:outputLabel value="{!Constants.constantOne}"/>
<apex:outputLabel value="{!$Constants.constantOne}"/>

 

soofsoof

I don't think you can 'directly' access the static variable from the class - you need to go via the controller.  Create a getter in the controller that returs Constants.contantOne, and access it from the VF page.

 

Thanks.