进入首页的action。CmsPageAct,首先在该action种判断网站是否使用了首页缓存。如果使用的首页缓存那么获取缓存,根据获取在内存中的首页缓存得到首页。
如果使用了首页换粗并且是第一次访问网站首页,那么在struts.xml文件中设置action的result的type的属性值为自定义的pageCache类型,该类型在struts-default.xml中定义。如下
<result-type name="pageCache" class="com.jeecms.core.web.PageCacheResult" />
PageCacheResult 继承了org.apache.struts2.views.freemarker.FreemarkerResult类。
即,result的类型应该是freemarker类型的,action的返回结果会先进入PageCacheResult,调用execute方法,在PageCacheResult中将模板页面呈现给视图,
页面的些缓存操作在PageCacheResult中的postTemplateProcess方法中进行,该方法是重写的父类FreemarkerResult的方法,该方法在调用父类的execute方法的时候自动调用。