I need to register an user and after that I would like to call a <rich:popupPanel> for example to show the error or successful message with an icon.
<rich:popupPanel id="popup" modal="false" autosized="true" resizeable="false">
<f:facet name="header">
<h:outputText value="Simple popup panel" />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#"
onclick="#{rich:component('popup')}.hide(); return false;">
X
</h:outputLink>
</f:facet>
<p>Any content might be inside this panel.</p>
</rich:popupPanel>
How do I do that after the validation of the register process in my controller ?
I could call a <h:message>, but I think a popupPanel with some icon and the status message would be more appropriate to the user.
In general, you’d just set some (boolean) toggle or a specific object property in the bean’s action method which is then used in the
renderedattribute of the containing component in question. Here’s an example with a simple boolean:with
You can also set some object property and then check if it is not empty or null. E.g. when the
Useris successfully saved after registration and thus got an ID from the DB:Note: in the particular case of your
<rich:popupPanel>, you can also use theshowattribute instead ofrenderedattribute.The only difference is that when
showisfalse, the component is still rendered, but then with CSSdisplay:none;so that it is visually hidden in the HTML DOM tree, so that you can redisplay it with just JavaScript.See also: