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
jucuzoglujucuzoglu 

How do you set up your controllers method and bind a non-SObject in VisualForce

I am performing a calculation and want to output the result of that calculation on a VisualForce page.

 

I have created a Controller Extension and have created a method that returns a Decimal. I'd like to display that result in my Visual Force page.

 

If I have a method called getCalculation that returns the decimal in my controller. Will that allow me to bind the variable with VisualForce or do I need to construct things differently in my controller?

Best Answer chosen by Admin (Salesforce Developers) 
Sam27Sam27

I think on visualforce page

 

{!calculation} 

 

will show the value returned from getCalculation method.

 

Hope that helps

 

Rahul Kumar