I have a jsp file pageshow.jsp and the parameter id,
Is there any way to cache the jsp file in server-side based on the url parameter
Requesting page pageshow.jsp?id=100 get from cache instead of building from server
Requesting page pageshow.jsp?id=200 get from cache instead of building from server
Above two pages should have different cache content since their parameter are different
This may avoid the rebuilding the jsp file in server side and also decrease the server load
I’d take a look at using a
CachingHttpFiltersimilar to what AlexR has proposed, but look at using the HTTP headers to control the caching rather than storing data in a roll-your-own-content-cache.This article explains nicely how to go about comparing the
If-Modified-SinceHTTP header when a URL is requested subsequent times. It’s then up to your Filter to send back aHTTP 304response.You will also want to look at the
ETagHTTP Header.Unfortunately caching sounds simple but is often difficult to get right. Tuning your database queries is often the best place to start with improving your application performance.