<apex:page controller="transientctrl">
t1 = {!t1}
t2 = {!t2}
<apex:form >
<apex:commandButton value="Refresh" />


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"


Does this mean that its only an AJAX page refresh and not the whole page refresh like from Observation 1 ?

  • 2
    A page refresh means that the entire page is rerendered, but the controller is not refreshed or re-instantiated. It's not necessaraly true that a refresh of the page means that the controller gets refreshed as well. If you hit F5 to refresh or just reload the URL the controller does get re-instantiated. Feb 8, 2015 at 18:39

1 Answer 1


Its not Ajax, It loads full page when you click Refresh.

Check with fire bug tool you will see all request details. You feel like page is rendered using Ajax because it is super fast. Actually it is loaded using most of cached contents and so loads very fast.

T2 is transient so its value is not preserved and it gets new value which is rendered with with VF page.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .