Ivá*_*ván 1 jsf caching primefaces jsf-2
我有一个 JSF 组件,它通过 ajax 请求通过按钮进行刷新。该组件具有按值顺序变化的图像。如果我查看网络请求,我可以看到我的浏览器没有缓存图像,而是在每次单击时请求它们。这会导致视图渲染中出现某种“弹出”现象。
我想通过缓存图像来加快刷新时间和渲染时间。我尝试在 GET 方法上使用 RequestFilter 将 Cache-Control 标头设置为“public”,但不起作用。
任何想法?
<!-- IMPLEMENTATION -->
<composite:implementation>
<h:panelGrid columns="2">
<c:choose>
<c:when test="#{cc.attrs.latencia ge cc.attrs.umbralAlto}">
<p:graphicImage value="#{resource['images:rojo.png']}"/>
</c:when>
<c:when test="#{(cc.attrs.latencia lt cc.attrs.umbralAlto) and (cc.attrs.latencia ge cc.attrs.umbralMedio)}">
<p:graphicImage value="#{resource['images:ambar.png']}"/>
</c:when>
<c:otherwise>
<p:graphicImage value="#{resource['images:verde.png']}"/>
</c:otherwise>
</c:choose>
<h:outputText value="#{cc.attrs.latencia} ms."/>
</h:panelGrid>
</composite:implementation>
Run Code Online (Sandbox Code Playgroud)
<h:body>
<h:form id="miForm">
<h:commandButton id="boton" value="Generar Latencia">
<f:ajax render="@form" event="click" listener="#{latencyBean.actualizarLatencia()}"/>
</h:commandButton>
<miscomponentes:LatencyIndicator latencia="#{latencyBean.latencia}"/>
</h:form>
</h:body>
Run Code Online (Sandbox Code Playgroud)
这可能有多种原因:
Development
上下文参数 将项目阶段设置为?因为在这种情况下 JSF 禁用了缓存。将参数设置为(默认值)应该启用缓存。javax.faces.PROJECT_STAGE
web.xml
Production
归档时间: |
|
查看次数: |
1242 次 |
最近记录: |