Skip to content

Instantly share code, notes, and snippets.

@nosrednawall
Created June 19, 2018 13:30
Show Gist options
  • Select an option

  • Save nosrednawall/1435d796503009d222b97488c401cd37 to your computer and use it in GitHub Desktop.

Select an option

Save nosrednawall/1435d796503009d222b97488c401cd37 to your computer and use it in GitHub Desktop.
renderiza telas xhtml primefaces
@ManagedBean(name="redBean")
@SessionScoped
public class Bean {
private Integer opcao;
private Boolean isRederiza = false;
public Boolean getIsRederiza() {
return isRederiza;
}
public Integer getOpcao() {
return opcao;
}
public void setOpcao(Integer opcao) {
this.opcao = opcao;
}
public void renderizar() {
if(getOpcao().equals(1)){
isRederiza = true;
} else {
isRederiza = false;
}
}
}
<h:form id="form1">
<p:panel style="width:700px;">
<p:panelGrid id="grade" columns="1">
<h:selectOneRadio id="radio" value="#{redBean.opcao}" >
<f:selectItem itemValue="1" itemLabel="Paciente" />
<f:selectItem itemValue="2" itemLabel="Secreária(o)" />
<f:selectItem itemValue="3" itemLabel="Nutricionista" />
<f:selectItem itemValue="4" itemLabel="Laboratório de Exames" />
<p:ajax listener="#{redBean.renderizar}" update=":form1:grade" />
</h:selectOneRadio>
<p:fieldset id="pac" legend="Paciente Selecionado" rendered="#{redBean.isRederiza}">
<h:outputLabel value="Paciente"/>
</p:fieldset>
</p:panelGrid>
</p:panel>
</h:form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment