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
devfredevfre 

Reg: Need help for getter setter methods

controller:

 

public obj testobj {
       get {
        if(testobj==null)
         testobj = new obj();

         return testobj;
         }
        set;
         }


VF page:

i'm using like this:

<apex:inputfield value="{!testobj.field}"/>  

 

i'm not able to pass the values entered in this field to apex code as i want to store the value enterd here in other place. i'm getting null value while debugging. can somebody help me whether my getter setter method is correct or not?

SFSolutionSFSolution

Hi,

 

You can simply write like below

 

public obj testobj {get;set;}

 

and in constructor 

 

testobj =new obj ();

 

Pleae let me if it not help to ypu..

 

devfredevfre

thanks for your reply.. i tried as you told.. but still i'm not getting the value, it is still giving the null value

SFSolutionSFSolution

Can you provide the code of visula force and apex class.. Seems error is some where esle..

devfredevfre

i tried debugging also.. value is not coming in the obj.. it is displaying null.. my class includes lot of methods and so long.. so i cant post it here