The following example represents a cached JSP page.
<%@ taglib prefix="mypfx" uri="/com/sun/web/taglibs/cache" %> <% String cacheKey = null; if (session != null) cacheKey = (String)session.getAttribute("loginId"); // check for nocache boolean noCache = false; String nc = request.getParameter("nocache"); if (nc != null) noCache = "true"; // force reload boolean reload=false; String refresh = request.getParameter("refresh"); if (refresh != null) reload = true; %> <mypfx:cache key="<%= cacheKey %/>" nocache="<%= noCache %/>" refresh="<%= reload %/>" timeout="10m"/> <% String page = request.getParameter("page"); if (page.equals("frontPage") { // get headlines from database } else { ..... %> </mypfx:cache/> <mypfx:cache timeout="1h"/> <h2> Local News </h2> <% // get the headline news and cache them %> </mypfx:cache/>