Page fragment caching impossible with coarse-grained rendered attribute evaluation in JSF
-----------------------------------------------------------------------------------------
Key: JBSEAM-3008
URL:
http://jira.jboss.com/jira/browse/JBSEAM-3008
Project: Seam
Issue Type: Task
Components: JSF Controls, JSF Integration
Reporter: Christian Bauer
The evaluation of the JSF rendered="true|false" attribute conflicts with the
Seam page fragment cache.
<s:cache region="test" key="foo123">
<h:outputText value="FOO" rendered="#{foo.bar}"/>
</s:cache>
The rendered attribute of the child components is ALWAYS evaluated, in potentially any JSF
phase (especially APPLY REQUEST VALUES and RENDER RESPONSE of course). No switch or
combination of JSF component settings and renderers is able to stop that evaluation; you
can not say "Do not call isRendered() on any child component of
<s:cache>".
So any rendered-attribute expression that is costly (e.g. rendered="#{not empty
myBackingBean.resultList}") will not be cached. This also means that there is a
disconnect between what is finally rendered by s:cache (some HTML from the cache) and what
the evaluation of the rendered attribute might produce. This is extremely difficult to
work around. One approach is to only use lightweight rendered="#{foo}"
expressions that can be evaluated many times without much cost.
I don't see any way to fix this unless the JSF specification is changed and a more
sane model of rendering/non-rendering switches is introduced. The rendered attribute is
used for all kinds of purposes inside the JSF engine, most of them have nothing to do with
rendering (e.g. it is used in APPLY REQUEST VALUES to detect which bindings need to be
evaluated back onto the model).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira