A setter method that assigns the value of this attribute to a class variable in the associated custom component controller. If this attribute is used, getter and setter methods, or a property with get and set values, must be defined.
Visualforce page:
<apex:page controller="sample" >
<apex:form >
<apex:outputText value="{!var}" id="a"/><br/>
<apex:commandButton value="Demo" action="{!demo}" rerender="a">
<apex:param assignTo="{!var}" value="orgn"/>
</apex:commandButton>
</apex:form>
</apex:page>
Apex Controller:
public class sample
{
public String var {get;set;}
public sample()
{
var = 'org';
}
public void demo()
{
System.debug(var);
}
}
Output:
Before clicking Demo Button:
After clicking Demo Button:
org has been changed to ‘orgn’ after clicking Demo button because orgn has been assigned to var.