A boolean button and dynamic menu with jsf Programming java html primefaces jsf

1

Hello,

I need to make a boolean button with jsf (primefaces) and html and a dynamic menu that one button calls another, but I have no idea how to do it. Can someone help me? I started doing something, these are the codes

    tests              

    <br><h:outputText value="Numero da Conta:  " /> <p:inputNumber
            value="#{cadastro.numConta}"></p:inputNumber></br>

    <br><h:outputText value="Saldo:  " /> <p:inputNumber
            value="#{cadastro.saldo}"></p:inputNumber></br>

    <br><h:outputText value="Nome:  " /> <p:inputText
            value="#{cadastro.nome}" /></br>
</h:form>
<h:form>
    <p:growl id="msgs" />

    <h:panelGrid columns="2" style="margin-bottom:12px" cellpadding="5">
        <h:outputText value="Confirmar cadastramento: " />
        <p:selectBooleanButton id="Nknow" onLabel="Sim" offLabel="Não">
            <p:ajax update="msgs" listener="#{selectBooleanView.addMessage()}"/>
        </p:selectBooleanButton>
    </h:panelGrid>
     <p:commandButton  value="Cadastrar"  icon="ui-icon-check" oncomplete="PF('dlg').show()" />
</h:form>

Class:

package org.primefaces.showcase.view.menu;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;

@ManagedBean
public class SelectBooleanView {

    private boolean value1;   
    private boolean value2;
    public int dia1;
    public int dia2;

    public boolean isValue1() {
        return value1;
    }

    public void setValue1(boolean value1) {
        this.value1 = value1;
    }

    public boolean isValue2() {
        return value2;
    }

    public void setValue2(boolean value2) {
        this.value2 = value2;
    }

    public void addMessage() {
        String summary = value2 ? "Checked" : "Unchecked";
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(summary));
    }
}

Other:

package classes.menu;

import javax.faces.bean.ManagedBean;


@ManagedBean
public class Cadastro {
    public String nome;
    public int numAge;
    public int numConta;
    public int getNumConta() {
        return numConta;
    }

    public void setNumConta(int numConta) {
        this.numConta = numConta;
    }

    public int getNumAge() {
        return numAge;
    }

    public void setNumAge(int numAge) {
        this.numAge = numAge;
    }

    public double getSaldo() {
        return saldo;
    }

    public void setSaldo(double saldo) {
        this.saldo = saldo;
    }

    public double saldo;

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }
}
    
asked by anonymous 03.04.2017 / 15:48

0 answers