Tag Archives: rendered

Primefaces ajax update on rendered attribute

rendered
If you are using rendered attribute on some component and want to update it on ajax request, you be noticed error.
So, that is normal because if rendered=”false” – this component will not be added to DOM tree.
That’s why it cannot be found on update callback.

For more info see
https://weblogs.java.net/blog/mriem/archive/2014/06/03/jsf-tip-62-understanding-renderedfalse.

To fix the problem wrap component into another container and make update on it.
For ex.

<p:outputPanel id="containerToUpdate">
    <p:panel rendered="#{SomeBean.isOk}">
        <!-- your code here -->
    </p:panel>
<p:outputPanel>

<p:commandButton update="containerToUpdate"/>

Thanx to http://stackoverflow.com/a/4525710.