Liferay中的Cache问题

最近在测试的时候,发现一个问题,就是IE的首页设为了该网站。

登录成功后,什么也不做,直接点击home的那个图标,画面会跑到登录画面去。

但是用户名,密码都不输入,直接点击登录就能够迁移到TOP画面。

其实如果是已经登录的情况下,不想跑到登录画面去,而是直接显示TOP画面。


查找了半天,发现是IE的cache的问题。

那么Liferay中cache的设置在那里呢?

是在theme中设置的,路径:/liferay-portal-src-6.0.X/portal-web/docroot/html/common/themes/top_meta.jspf

下面的code中设置的nocache的。因为是用一个flag来控制的。登录画面的时候页面并没有设置nocache。

<%
String cacheControl = request.getParameter("cache_control");
%>

<c:if test='<%=  ((cacheControl != null) && (cacheControl.equals("0"))) %>'>
    <meta content="no-cache" http-equiv="Cache-Control" />
    <meta content="no-cache" http-equiv="Pragma" />
    <meta content="0" http-equiv="Expires" />
</c:if>

经过改造,如果是没有登录的时候设置nocache。实例代码如下:

<%
String cacheControl = request.getParameter("cache_control");
boolean isNochache = false;
LastPath lastPath = (LastPath)session.getAttribute(WebKeys.LAST_PATH);
if (lastPath == null || "/".equals(lastPath.getPath()) || "/home".equals(lastPath.getPath())) {
    isNochache = true;
}
%>

<c:if test='<%= isNochache || ((cacheControl != null) && (cacheControl.equals("0"))) %>'>
    <meta content="no-cache" http-equiv="Cache-Control" />
    <meta content="no-cache" http-equiv="Pragma" />
    <meta content="0" http-equiv="Expires" />
</c:if>




你可能感兴趣的:(cache,String,IE,测试,null,Path)