JAVA Nullpointexception

Asked

Viewed 35 times

1

by clicking on my button in the view the parameter is not arriving in my attribute java responsible for the button


public Map<String, Object> getFiltroGlobalMap(){
    Map<String, Object> mapFiltrosGlobais = new HashMap<String, Object>();

    if (tipoDigitalizacaoFiltroSelect != null) {
        mapFiltrosGlobais.put("tipoDigitalizacao", tipoDigitalizacaoFiltroSelect);
    }
    if (listUnidadeOrganizacionalFiltro != null && listUnidadeOrganizacionalFiltro.isEmpty() == false) {
        mapFiltrosGlobais.put("unidadeOrganizacional", listUnidadeOrganizacionalFiltro);
    }
    if(dataVencimentoInicioFiltro != null){
        Uteis.zeraHoraData(dataVencimentoInicioFiltro);
        mapFiltrosGlobais.put("dataVencimentoNotaInicio", dataVencimentoInicioFiltro);
    }
    if(dataVencimentoFimFiltro != null){
        Uteis.setUltimaHoraData(dataVencimentoFimFiltro);
        mapFiltrosGlobais.put("dataVencimentoNotaFim", dataVencimentoFimFiltro);
    }
    if(dataAprovDiretorInicioFiltro != null){
        Uteis.zeraHoraData(dataAprovDiretorInicioFiltro);
        mapFiltrosGlobais.put("dataAprovDiretorInicio", dataAprovDiretorInicioFiltro);
    }
    if(dataAprovDiretorFimFiltro != null){
        Uteis.setUltimaHoraData(dataAprovDiretorFimFiltro);
        mapFiltrosGlobais.put("dataAprovDiretorFim", dataAprovDiretorFimFiltro);
    }
    if(!StringUtils.isBlank(getFiltroIsMei()) && getFiltroIsMei() !=null){
        mapFiltrosGlobais.put("filtroIsMei",getFiltroIsMei().equals("SIM")?Boolean.TRUE:Boolean.FALSE);
    }

    return mapFiltrosGlobais;
}

modo debug, não esta passando pela minha variavel

código xhtml do meu button, que manda a resposta para o lado java

  • by clicking the Boolean button in the view it is not reaching my java attribute to get the information.

1 answer

0

You made the Submit of the form that is this selectOneButton? Just the act of clicking on selectOneButton does not commit the form, unless you put some ajax function in it.

Here is an example of the implementation of this component:

<h:form>
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">
    <h:outputText value="Platform:" />
    <p:selectOneButton value="#{selectOneView.option}">
        <f:selectItem itemLabel="Xbox One" itemValue="Xbox One" />
        <f:selectItem itemLabel="PS4" itemValue="PS4" />
        <f:selectItem itemLabel="Wii U" itemValue="Wii U" />
    </p:selectOneButton>

    <p:commandButton value="Submit" update="display" icon="ui-icon-check" />
    <p:spacer />

    <h:outputText value="Selected:" />
    <h:outputText id="display" value="#{selectOneView.option}" style="font-weight: bold" />
</h:panelGrid>

View:

import javax.faces.bean.ManagedBean;


@ManagedBean
public class SelectOneView {

    private String option;

    public String getOption() {
        return option;
    }

    public void setOption(String option) {
        this.option = option;
    }
}

Browser other questions tagged

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