Galera, fiz o seguinte código:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
template="/layout/template.xhtml">
<ui:define name="body">
<div id="page-wrap" >
<h:form id="consulta">
<h1>Consulta</h1>
<div class="name_wrap2" align="center" style=" margin: 14px 22px; width:955px;" >
<rich:panel id="pesquisa">
<h:inputText required="false" name="creciPesq" value="#{creciCorretor}" label="Creci:"/> <!--AQUI TÁ O PROBLEMA -->
<br />
<h:commandButton immediate="true" reRender="resultado" value="Pesquisar" />
</rich:panel>
</div>
<div id="resultado" class="name_wrap2" align="center" style=" margin: 14px 22px;" >
<rich:panel id="result">
<h:dataTable noResultMessage="Nenhum registro encontrado." name="listaCor" value="#{corretorAction.listaCorretores()}" var="corretorDados" rows="20" >
<h:column label="Creci" value="#{corretorDados.corretorCreci}"/>
<h:column style="width:600px;" label="Nome" value="#{corretorDados.pessoa.nomePessoa}" clientOrder="true" />
<h:column style="width:100px;" label="Classificação" value="#{corretorDados.classificacao.nomeClassificacao}" />
<h:column style="width:100px;" label="Título" value="#{corretorPessoa.titulo.nomeTitulo}"/>
<h:column style="width: 100px" label="Situação" value="#{corretorPessoa.situacao.nomeSituacao}"></h:column>
<rich:column style="width:50px;" filterValue="#{corretorPessoa.statusCorretor}">
<f:facet name="header">
<h:outputText value="Status" />
</f:facet>
<s:div style="float:center; text-align:center;">
<h:commandLink title="#{corretorPessoa.statusCorretor.nomeStatus}" actionListener="#{corretorAction.alterarStatus()}" onclick="return confirm('Deseja realmente alterar o status desse corretor?');" >
<a4j:support event="onchange" limitToList="true" ajaxSingle="true" bypassUpdates="false" reRender="resultado" />
<img />
</h:commandLink>
</s:div>
</rich:column>
<rich:column style="width:50px;">
<f:facet name="header">
<h:outputText value="Editar" />
</f:facet>
<s:div style="float:center; text-align:center;">
<h:commandLink action="#{corretorAction.editarCorretor(corretorDados)}" title="Editar">
<img />
</h:commandLink>
</s:div>
</rich:column>
</h:dataTable>
<h:commandButton id="voltar" value="Voltar" action="VOLTAR"/>
</rich:panel>
</div>
</h:form>
</div>
</ui:define>
</ui:composition>
Na linha onde eu coloco <h:inputText required="false" name="creciPesq" value="#{creciCorretor}" label="Creci:"/> estou passando o value para uma String que criei na Action.
Código da action:
imports .......
@Name("corretorAction")
@Scope(ScopeType.CONVERSATION)
public class CorretorAction {
//****************************** VÁRIAVEIS ****************************************\\
@In
private StatusMessages statusMessages;
//AQUI ESTÁ A "CRIANÇA"
@In(required=false)
@Out(required=false)
private String creciCorretor;
@In
private CorretorManager corretorManager;
@In(required=false)
@Out(required=false)
public CorretorPessoa corretorPessoa;
@Out(required=false)
public Pessoa pessoa = new Pessoa();
//****************************** GETTERES AND SETTERES ****************************************\\
.
.
.
//GET AND SET DA "CRIANÇA"
public String getCreciCorretor() {
return creciCorretor;
}
public void setCreciCorretor(String creciCorretor) {
this.creciCorretor = creciCorretor;
}
//****************************** MÉTODOS ****************************************\\
public List<CorretorPessoa> listaCorretores() {
System.out.println(creciCorretor);
return this.corretorManager.listaCorretores();
}
.
.
.
}
O problema é que quando eu digito um valor no campo Creci ele não passa p/ variável que criei. Sempre me retorna null.
O que tem de errado no meu código?