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
prabhavathi sharmaprabhavathi sharma 

write an apex class to return the values to visualforce page

HI EVERYONE 

MY QUESTION IS write an apex class to return the values to visualforce page

I Wrote this example where I did mistake please tell me

APEX CODE
public class example1 {

     public Integar age;
     public Example1()
     {
         age=10;
     }
     public Integar getAge()
     {
         return age;
     }
     public string getName()
     {
         return 'krishna';
     }

}

VISUALFORCE PAGE
<apex:page controller="Example1">
<apex:outputlabel>{!age}</apex:outputlabel>
 <apex:outputlabel>{!name}</apex:outputlabel>
</apex:page>



 
sfdcMonkey.comsfdcMonkey.com
hi prabhavathi sharma
use {get;set;}  property for access class variable to vf  page  and set value by class constructor
public class example1 {

     public Integer age {get;set;}
    public String Name{get;set;} 
    
     public Example1(){
         age = 10;
         name = 'Krishna';
     }
    /* public Integer getAge()
     {
         return age;
     }
     public string getName()
     {
         return 'krishna';
     }*/

}
thanks
let me inform if it helps you and mark it best answer if my answer helps you