I have this piece of code:
JSF and JSTL doesn't run in sync as you'd expect from the coding. JSTL runs during build time of the view (when the JSF component tree is to be populated) and JSF runs during render time of the view component tree (when HTML output is to be generated). You can visualize it as follows: JSTL runs first from top to bottom and then hands over the result to JSF which in turn runs from top to bottom again.
In your particular case, the object instance
is never present in JSTL.
Instead of c:forEach
, you should use ui:repeat
and instead of c:if
you should use JSF component's rendered
attribute. I'd like to give a rewrite of the code, but the usage of hideTypes
is a mess. Rather convert it to a List<String>
in the model and it'll be much easier to do with pure JSF. Here's a kickoff example assuming that hideTypes
is a List<String>
:
<h:panelGroup rendered="#{not empty hideTypes}">
<ui:repeat value="#{document.instanceList}" var="instance">
<a:outputPanel rendered="#{!hideTypes.contains(instance.documentInstanceType.mimeType)}">
<up:mimeTypeIcon type="#{instance.documentInstanceType.mimeType}"
icon="#{instance.documentInstanceType.iconPath}"
key="#{instance.instanceKey}" referenced="false"/>
</a:outputPanel>
</ui:repeat>
<h:panelGroup>