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

Asked

Viewed 140 times

1

Hello,

I need to make a Boolean button with jsf (primefaces) and html and a dynamic menu that one button calls another, only I have no idea how to do. Can anyone 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;
    }
}
  • What would the menu look like? Explain in more detail

  • I need a menu that when you press the Option Button appears the Registration, Withdrawal and Deposit options and goes to the page of the chosen option .

  • If I understand correctly, I recommend you look at the tabView of the first faces, I believe it will be useful, The link Here

  • I’ll take a look, anything colto here. Thank you

  • I got it another way, just by putting in the url the file path of the other menu. Thank you

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.