I've encountered a problem with JSP pages server-side caching.
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:
<%!private String <b>abc</b> = UUID.randomUUID().toString();%>
After a few requests...the variable abc seems to be cached on the server side and the same value keep poping up.
Oddly enough, on the same page, I also display the time in which the error is encountered with
XXXError encountered on <%=Calendar.getInstance().getTime().toString()%>
which never gets cached and always display the current time.
So I did a little experiment, instead of displaying time using the above, I used
<%!private String etime = Calendar.getInstance().getTime().toString();%>
and print onscreen that string, and SNAP, it's getting cached after a few calls.
So my question is, how do I stop the server from caching these variables?