VF
<apex:page controller="transientctrl">
t1 = {!t1}
<p/>
t2 = {!t2}
<apex:form >
<apex:commandButton value="Refresh" />
</apex:form>
</apex:page>
Controller
public class transientctrl {
DateTime t1;
transient DateTime t2;
public String getT1()
{
if(t1 == null) t1 = System.now();
return ' '+t1;
}
public String getT2()
{
if(t2 == null) t2 = System.now();
return ' '+t2;
}
}
Observation 1 :
After the page is rendered if I click on "F5" or do a browser refresh, the values of T1 & T2 are the same and are generated freshly.
Observation 2 :
On the other hand if I click on the command button the value of T1 remain the same while the T2 is generated freshly. Can someone let me know why is it like that ?.
I am guessing it is because I have not specified any value for "action" attribute on the command button so as per the doc "If an action isn't specified, the page simply refreshes"
http://www.salesforce.com/docs/developer/pages/Content/pages_compref_commandButton.htm
Does this mean that its only an AJAX page refresh and not the whole page refresh like from Observation 1 ?