Rony,

On 4/18/21 08:06, Rony G. Flatscher (Apache) wrote:
On 11.03.2021 12:23, Rony G. Flatscher (Apache) wrote:
On 11.03.2021 11:53, Mark Thomas wrote:
On 10/03/2021 15:14, Rony G. Flatscher (Apache) wrote:
Is there a way to know/infer that a JSP got freshly compiled from e.g. a taglib 
library?

For caching purposes it would be necessary to learn whether a JSP got 
recompiled as the cache should
be purged in that case.

Is there a way to find out whether a JSP run is the very first after 
(re-)compilation?

Or can one rely that if a JSP gets recompiled that a new PageContext gets 
created for it (or if
reused does not contain any custom attributes placed there earlier at the 
PAGE_SCOPE)?
Page scope gets reset at the end of a request so that won't work.

It might not be perfect (containers are allowed to unload unused servlets/JSPs) 
but in you are
using Tomcat and haven't configured maxLoadedJsps or jspIdleTimeout then you 
should be able to use
the jspInit() method. (See JSP spec for details).

It seems that the implicit JSP "page" object can probably be used to determine 
whether a JSP got
recompiled as its hashCode() changes after recompilation.

Something safer might be to keep a cache of datestamps keyed by JSP name (or whatever). When the JSP's init() method is called, you could update the datestamp.

Or do you need to know about the recompliation before the init() is called?

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to