title: JSP Page Variable Caching
body: <p>I've encountered a problem with JSP pages server-side caching.</p>
  
  <p>Suppose I have an internal error page which is a custom JSP that will display a unique ID each time it's visited/requested. This unique ID is also logged in the server log for debugging. However, I noticed that if I implement the error ID using:</p>
  
  <pre><code>&lt;%!private String &lt;b&gt;abc&lt;/b&gt; = UUID.randomUUID().toString();%&gt;
  </code></pre>
  
  <p>After a few requests...the variable <b>abc</b> seems to be cached on the server side and the same value keep poping up.</p>
  
  <p>Oddly enough, on the same page, I also display the time in which the error is encountered with</p>
  
  <pre><code>XXXError encountered on &lt;%=Calendar.getInstance().getTime().toString()%&gt;
  </code></pre>
  
  <p>which never gets cached and always display the current time.</p>
  
  <p>So I did a little experiment, instead of displaying time using the above, I used</p>
  
  <pre><code>&lt;%!private String etime = Calendar.getInstance().getTime().toString();%&gt;
  </code></pre>
  
  <p>and print onscreen that string, and SNAP, it's getting cached after a few calls.</p>
  
  <p>So my question is, how do I stop the server from caching these variables?</p>