Difference between rendered and visible attributes of

The rendered attribute is server-side and the visible attribute is client-side. The rendered attribute tells whether JSF should generate the dialog’s HTML representation or not. The visible attribute tells whether HTML/CSS/JS should immediately show the dialog on browser’s page load or not.

If the dialog isn’t rendered, then you won’t be able to display it by for example JavaScript dialogWidgetVar.show() without reloading the page or ajax-updating one of the dialog’s parent components that way so that the dialog’s rendered condition evaluates to true. Also the visible attribute won’t have any effect if the dialog is not rendered simply because there’s nothing being rendered to the resulting HTML output which could be shown/hidden by JavaScript.

If the dialog is rendered, then it is by default hidden. You can set visible to true to force it to display the dialog immediately whenever the page is opened. Or you can invoke JavaScript dialogWidgetVar.show() in some onclick or oncomplete attribute to show it.

Use the rendered attribute if you don’t want to render the dialog at all, for example because it wouldn’t ever be used anyway in the currently requested page composition.

Leave a Comment