【发布时间】:2012-06-26 02:21:41
【问题描述】:
当我更改我的 xhtml 文件时,JBoss JSF 页面缓存似乎并不总是更新。例如:
模板
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:f="http://java.sun.com/jsf/core">
<f:view contentType="text/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="cache-control" content="must-revalidate"/>
<meta http-equiv="expires" content="-1"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
</h:head>
<h:body>
<ui:insert name="body"/>
</h:body>
</f:view>
</html>
MyPage.xhtml
<ui:composition template="template.xhtml">
<ui:define name="body">
<h:outputText value="Some text"/>
</ui:define>
</ui:composition>
如果我现在加载 MyPage.jsf,它将显示“一些文本”。现在我将分解包中的“一些文本”更改为“更改的文本”并重新加载页面。该页面将显示新文本。但是,如果我再次更改它,它仍然会显示旧值。问题似乎来来去去,但当它出现时适用于我的所有页面。每个页面只反映一次更改,然后它似乎会缓存自己并且不会放手,直到我重新加载应用程序或等待几分钟让缓存自行失效。这在开发过程中非常烦人。
有没有办法解决这个问题?
【问题讨论】:
-
我也有同样的问题。你找到解决办法了吗?
-
不是一个具体的解决方案,但是自从我切换 IDE 后问题已经消失了,所以它可能与此有关。我之前使用过 Netbeans 并从 IDE 运行服务器。现在我使用似乎运行良好的 ant 脚本更新资源。这可能是一个时间戳问题。