﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-兴趣与爱好-文章分类-Portal</title><link>http://www.blogjava.net/kennyr/category/32979.html</link><description>学习交流</description><language>zh-cn</language><lastBuildDate>Sat, 12 Jul 2008 11:41:06 GMT</lastBuildDate><pubDate>Sat, 12 Jul 2008 11:41:06 GMT</pubDate><ttl>60</ttl><item><title>liferay页面缓存问题解决</title><link>http://www.blogjava.net/kennyr/articles/214440.html</link><dc:creator>-南风</dc:creator><author>-南风</author><pubDate>Sat, 12 Jul 2008 08:00:00 GMT</pubDate><guid>http://www.blogjava.net/kennyr/articles/214440.html</guid><wfw:comment>http://www.blogjava.net/kennyr/comments/214440.html</wfw:comment><comments>http://www.blogjava.net/kennyr/articles/214440.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kennyr/comments/commentRss/214440.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kennyr/services/trackbacks/214440.html</trackback:ping><description><![CDATA[<h4 style="margin-bottom: 0px"><font size="2">liferay页面缓存问题解决</font></h4>
<div><font size="2">　　Liferay页面使用缓存，在未登录时，页面只做一次加载，即使对JSP文件修改，页面有时也没法重新加载。但在登录之后，每一个请求每一个页面时都会重新加载。在网上查了很多资料，使用那些方法对一般的JSP页面都有作用，但对Liferay却没有效果。</font></div>
<div><font size="2">　　经过研究发现，Liferay缓存是通过filter实现的，即 com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter，在 system.properties中有对应的设置， com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter=false，则 每次都有对服务器重新请求。</font><br />
<br />
飞速按他说的去做，发现没反映，研究发现，这只是针对开发环境的设置。所以在Tomcat目录中找到<br />
web.xml（D:\lifeportal\tomcat\webapps\ROOT\WEB-INF）,打开后修改如下：<br />
将：<br />
&lt;filter&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;filter-name&gt;Layout Cache Filter - Friendly&lt;/filter-name&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;filter-class&gt;com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter&lt;/filter-class&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;init-param&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param-name&gt;pattern&lt;/param-name&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param-value&gt;0&lt;/param-value&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/init-param&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/filter&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;filter&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;filter-name&gt;Layout Cache Filter - Layout&lt;/filter-name&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;filter-class&gt;com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter&lt;/filter-class&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;init-param&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param-name&gt;pattern&lt;/param-name&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param-value&gt;1&lt;/param-value&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/init-param&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/filter&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;filter&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;filter-name&gt;Layout Cache Filter - Resource&lt;/filter-name&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;filter-class&gt;com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter&lt;/filter-class&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;init-param&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param-name&gt;pattern&lt;/param-name&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param-value&gt;2&lt;/param-value&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/init-param&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/filter&gt;<br />
<br />
改为：&lt;filter&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;filter-name&gt;Layout Cache Filter - Friendly&lt;/filter-name&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;filter-class&gt;com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter&lt;/filter-class&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;init-param&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param-name&gt;pattern&lt;/param-name&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<span style="font-weight: bold">&nbsp; &lt;param-value&gt;0&lt;/param-value&gt;</span><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/init-param&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/filter&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;filter&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;filter-name&gt;Layout Cache Filter - Layout&lt;/filter-name&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;filter-class&gt;com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter&lt;/filter-class&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;init-param&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param-name&gt;pattern&lt;/param-name&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<span style="font-weight: bold"> &nbsp;&nbsp;&nbsp; &lt;param-value&gt;0&lt;/param-value&gt;</span><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/init-param&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/filter&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;filter&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;filter-name&gt;Layout Cache Filter - Resource&lt;/filter-name&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;filter-class&gt;com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter&lt;/filter-class&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;init-param&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param-name&gt;pattern&lt;/param-name&gt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<span style="font-weight: bold">&nbsp;&nbsp; &lt;param-value&gt;0&lt;/param-value&gt;</span><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/init-param&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/filter&gt;</div>
<img src ="http://www.blogjava.net/kennyr/aggbug/214440.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kennyr/" target="_blank">-南风</a> 2008-07-12 16:00 <a href="http://www.blogjava.net/kennyr/articles/214440.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>