Get Method:-
When visualforce page want to get the value of a variable defined in the the apex . It will invoke get method of that variable.
Ex;
<apex:outputlabel>{!myname}</apex:outputlabel>
This is a variable defined in apex class. In the above statement visual-force page is trying to use myname variable which is declared in Apex class. so its invoke automatically getmyname( ) method in the apex class and this method will return the values of that.
Public class Example
{
String name;
Public Void set(string name)
{
this.name=name;
}
Public String getname( )
{
return name;
}
}
Ex:
Public Class Example1
{
Integer no;
Public Void set(string Integer no)
{
this.no=no:
}
Public ?Integer getNo( )
{
return no;
}
}
When visualforce page want to get the value of a variable defined in the the apex . It will invoke get method of that variable.
Ex;
<apex:outputlabel>{!myname}</apex:outputlabel>
This is a variable defined in apex class. In the above statement visual-force page is trying to use myname variable which is declared in Apex class. so its invoke automatically getmyname( ) method in the apex class and this method will return the values of that.
Public class Example
{
String name;
Public Void set(string name)
{
this.name=name;
}
Public String getname( )
{
return name;
}
}
Ex:
Public Class Example1
{
Integer no;
Public Void set(string Integer no)
{
this.no=no:
}
Public ?Integer getNo( )
{
return no;
}
}
No comments:
Post a Comment