<div jsf:rendered="#{false}">div NOT rendered</diiv>
<div jsf:rendered="#{true}">div IS rendered</diiv>
<p jsf:rendered="#{false}">p NOT rendered</diiv>
<p jsf:rendered="#{true}">p IS rendered</diiv>
<button type="button" jsf:rendered="#{false}">button NOT rendered</button>
<button type="button" jsf:rendered="#{true}">button is RENDERED</button>
However if the element is an <a> then the jsf:rendered is not applied if the element does not have something like an jsf:outcome or jsf:action for example:
Would expect that the jsf:rendered attribute is applied to any html element. It appears that the <a> element is being treated differently.
https://github.com/eclipse-ee4j/mojarra/issues/5212 was opened on this and it was determined that is is because the <a> could be handled by multiple components (h:link, h:commandButton, etc) and since there is no identifying attribute (jsf:action or jsf:outcome for example).
I would propose that if no identifying attribute is found then it should be treated like any other html element (like a div) and the jsf:rendered should still be considered. Otherwise this is confusing and can lead to elements being rendered to the user unexpectedly.
The following works fine in JSF 2.3
However if the element is an
<a>
then the jsf:rendered is not applied if the element does not have something like anjsf:outcome
orjsf:action
for example:Expected behavior
Would expect that the
jsf:rendered
attribute is applied to any html element. It appears that the<a>
element is being treated differently.https://github.com/eclipse-ee4j/mojarra/issues/5212 was opened on this and it was determined that is is because the
<a>
could be handled by multiple components (h:link
,h:commandButton
, etc) and since there is no identifying attribute (jsf:action
orjsf:outcome
for example).I would propose that if no identifying attribute is found then it should be treated like any other html element (like a div) and the
jsf:rendered
should still be considered. Otherwise this is confusing and can lead to elements being rendered to the user unexpectedly.