Fala Galera.
Estou estudando JSF 2.0 e me deparei com o seguinte problema.
Tenho uma lista com dois inputText’s, preço Mínimo e preço Máximo. Quando o usuário realizar a pesquisa preciso validar se o preço mínimo é menor que o preço máximo.
Tenho uma classe chamada ValidatePreco que implemeta “javax.faces.validator.Validator”, porém preciso sobrescrever o método validate e esse método so aceita um valor.
Existe um jeito de eu recuperar os dois valores ao mesmo tempo para fazer a validação?
Segue a classe e a tela abaixo:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <f:view>
            <h:form>
                <h:inputText id="txtMinPreco"/>
                <h:inputText id="txtMaxPreco"/>
            </h:form>
            <h:form>
                <h:dataTable value="#{ListaCdBean.all}" var="cd">
                    <h:column>
                        <h:commandLink action="cd" value="Editar">
                            <f:setPropertyActionListener value="#{cd}" target="#{CdBean.cd}"/>
                        </h:commandLink>
                    </h:column>
                    <h:column>
                        <h:commandLink action="#{ListaCdBean.excluir(cd)}" value="Excluir">
                        </h:commandLink>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            id
                        </f:facet>
                        #{cd.id}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Cantor
                        </f:facet>
                        #{cd.cantor}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Título
                        </f:facet>
                        #{cd.titulo}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Preço
                        </f:facet>
                        #{cd.preco}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Ano
                        </f:facet>
                        #{cd.anoLancamento.anoLancamento}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Gênero
                        </f:facet>
                        #{cd.genero.genero}
                    </h:column>
                </h:dataTable>
            </h:form>
        </f:view>
    </h:body>
</html>package s2.validator;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
@FacesValidator("ValidatePreco")
public class ValidatePreco implements Validator {
    @Override
    public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
    }
}Obrigado.