[RESOLVIDO]Meu input é submetido pelo botão porém valor não chega no bean para comparar no select

3 respostas Resolvido
primefacesjsfhibernate
Humberto_Marthan

Minha Bean

public void busca() throws Exception {
    		StringBuilder str = new StringBuilder();
    		str.append("from Prontuario a where 1=1");
    		if (!campoBusca().equals("")) {
    			str.append(" and a.paciente.pessoa.pessoaNome like'%" + campoBusca() + "%'");
    		}
    		listaProntuario = 
    				prontuarioController.findListByQueryDinamica
    				(str.toString());
    		//campoBusca="";
    	}

Meu Xhtml

<p:inputText size="45"
											value="#{prontuarioBeanView.campoBusca}"
											placeholder="Buscar pelo Nome" id="inputCampo" />
										<span> 
										<p:commandButton
												type="submit" immediate="true" icon="ui-icon-search"
												id="btnBuscatxt" action="#{prontuarioBeanView.busca}"
												actionListener="#{prontuarioBeanView.busca}"
												update="table, inputCampo" />
										</span>
								

									<p:dataTable id="table" var="a" widgetVar="table" 
										emptyMessage="Não há Agendamentos" rowKey="#{a.idProntuario}"
										selectionMode="single" selection="#{prontuarioBeanView.prontuarioModel}"
										value="#{prontuarioBeanView.listaProntuario}">

										<p:column headerText="Paciente">
											<p:outputLabel value="#{a.paciente.pessoa.pessoaNome}" />
										</p:column>
										<p:column headerText="Diagnóstico">
											<p:outputLabel value="#{a.diagnostico}" />
										</p:column>

										<p:column headerText="Prescricao">
											<p:outputLabel value="#{a.prescricao}" />
										</p:column>

									</p:dataTable>

3 Respostas

Lucas_Camara

Esse código está dentro de um form?

Humberto_Marthan

Sim

Humberto_Marthan
Solucao aceita

O problema era o escopo do Bean, mudei para ViewScope e resolveu

Criado 3 de julho de 2019
Ultima resposta 6 de jul. de 2019
Respostas 3
Participantes 2