对于那些无法再看到问题的人来说,我是错误的,也许您“从外面看”可以帮助我。
问题很简单,我没有从ManagedBean的视图中获得输入的值。此输入:
此cpffind字段未在另一侧分配。实际调试中,我发现它都没有调用属性的set方法
实际上是调试时,我发现它都没有调用属性的set方法
<p:panel id="titularDetail" style="text-align:center;">
<p:dialog width="800" height="300" responsive="true"
appendTo="@(body)" closable="false" header="Busca de titular"
widgetVar="titularDialog" modal="true" showEffect="fade"
hideEffect="fade" resizable="false">
<p:panelGrid columns="2" id="capaPanel15">
<p:outputLabel value="CPF do titular" />
<p:inputMask value="#{cadastroClienteMB.cpffind}"
mask="999-999-999-99" />
<p:outputLabel value="Habilitação do titular" />
<p:inputMask mask="9999-999999-9" />
</p:panelGrid>
<p:commandButton process="@this" update="table_resp"
actionListener="#{cadastroClienteMB.findTitularByCpf()}"
styleClass="btn btn-primary" value="Buscar" />
<p:commandButton oncomplete="PF('titularDialog').hide();"
styleClass="btn btn-danger" value="Fechar" />
<p:dataTable value="#{cadastroClienteMB.responsavel}"
var="responsavel" selection="true" emptyMessage="Sem responsáveis"
id="table_resp">
<p:column headerText="Nome">
<p:outputLabel value="#{responsavel.nmcliente}" />
</p:column>
<p:column headerText="CPF">
<p:outputLabel value="#{responsavel.nucpf}" />
</p:column>
<p:column headerText="Nome da mãe">
<p:outputLabel value="#{responsavel.nmmae}" />
</p:column>
</p:dataTable>
</p:dialog>
</p:panel>
</h:form>
@ManagedBean
@SessionScoped
public class CadastroClienteMB implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private Clientela clientela = new Clientela();
private Integer habilitacaodotitular;
// colocar na hora de persistir
private boolean isestudante;
// colocar na hora de persistir
private boolean ispcd;
// colocar na hora de persistir
private boolean isemancipado;
// colocar na hora de persistir
private String sigla_estados;
// colocar na hora de persistir
private Municipio municipio;
// colocar na hora de persistir
private String celular;
// colocar na hora de persistir
private String fixo;
// colocar na hora de persistir
private String email;
// colocar na hora de persistir
private String endereco_dslogradou;
// colocar na hora de persistir
private String endereco_nuimovel;
// colocar na hora de persistir
private String endereco_dscomplemen;
// colocar na hora de persistir
private String endereco_dsbairro;
// colocar na hora de persistir
private String endereco_nucep;
private String cpffind;
private Clientela responsavel;
public Clientela getResponsavel() {
return responsavel;
}
public void setResponsavel(Clientela responsavel) {
this.responsavel = responsavel;
}
public String getCpffind() {
return cpffind;
}
//获取器和设置器
public List<Municipio> findAllEstates() {
Service service = new Service();
System.out.println("Estado Selecionado: " + this.getSigla_estados());
if (this.getSigla_estados() != null) {
String retorno = service.getEndpoint("municipio/findAllMunicipioFrom", this.getSigla_estados());
List<Municipio> listaMunicipios = new Gson().fromJson(retorno, new TypeToken<List<Municipio>>() {
}.getType());
this.municipios = listaMunicipios;
return listaMunicipios;
}
return null;
}
public Clientela findTitularByCpf() {
System.out.println("chamou findCPF: " + this.getCpffind());
Service service = new Service();
// if(this.getCpf_titular_find()== null || this.getCpf_titular_find()。equals(“”)){ // this.setCpf_titular_find(“ 11111111111”); //}
String retorno = service.getEndpoint("clientela/findOneClienteCPF=", this.getCpffind());
Gson g = new GsonBuilder().setDateFormat("dd-MM-yyyy").create();
Clientela responsavelvindo = g.fromJson(retorno, Clientela.class);
// Clientela responsavelvindo = new Gson().fromJson(retorno, Clientela.class);
this.responsavel = responsavelvindo;
return responsavelvindo;
}
}