What I would do is something like:
<h:panelGroup rendered="#{myBean.panelDisplayed}">
// some markup with jsf components
</h:panelGroup>
<h:commandLink value="Render The Panel" action="#{myBean.showPanel}"/>
In your backing bean (myBean), you'd have two methods:
public boolean isPanelDisplayed() {
return this.isPanelDisplayed;
}
public String showPanel() {
// some business logic maybe
this.isPanelDisplayed = true;
return null; // this will render the same page again
}
I hope this helps.
Adam Brod
Product Development Team
From:
"Todd Patrick" <Todd.Patrick_at_dtn.com>
To:
<users_at_javaserverfaces.dev.java.net>
Date:
04/05/2007 04:20 PM
Subject:
A concept question. How do I initially hide (do not render) a component
initially on a page?
I am trying to figure out the following, which I can code ? but I am
unsure about the proper approach.
I have a UIPanel with children on a single JSF page.
What I want is to not render ? UIPanel.setRendered(false) ? the first time
the page loads. I only want to render the UIPanel within a condition
inside an Action, i.e. a user clicks on a HtmlCommandButton.
So my question is what is the best way to approach this? What is the right
concept?
Do I have the UIPanel with children in the JSF page and set the
UIPanel.setRendered(false) in the backing bean constructor?
Do I have an empty UIPanel binded to a backing bean property and in Java
code add the children?
What is the *best* or *correct* way to approach this concept?
Thanks,
--Todd
NOTICE: This email message is for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. Any unauthorized use, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact
the sender by reply email and destroy all copies of the original
message.
Disclaimer: This electronic mail and any attachments are confidential and may be privileged. If you are not the intended recipient, please notify the sender immediately by replying to this email, and destroy all copies of this email and any attachments. Thank you.