show hide elements JSF / primefaces with ajax

Posted: May 24, 2012 in web

<p:selectOneRadio value="#{test.panel1}">
 <f:selectItem itemLabel="Yes" itemValue="Show-Panel1" />
 <f:selectItem itemLabel="No" itemValue="Hide-Panel1" />
 <f:ajax render="payment-amount-panel" />
</p:selectOneRadio>

<h:panelGroup id="payment-amount-panel">

<p:fieldset legend="Payment"
 rendered="#{test.panel1 == 'Show-Panel1'}">

//more elements here...

</p:fieldset>

</h:panelGroup>

Bean:

public class Test {

private String panel1 = “Hide-Panel1”;

public void setPanel1(String panel1){
this.panel1 = panel1;
}

public String getPanel1(){
return this.panel1;
}

…….

Advertisements
Comments
  1. Gio says:

    fine example thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s