+ Start a Discussion

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}"/>



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.