Olá, tenho esse formulário para login que tem um validador (checar senha correta) no botão de submit mas não está enviando o action para o BB, o que estou fazendo errado?
XHTML:
[code]<?xml version='1.0' encoding='UTF-8' ?>
<body>
<ui:composition template="/templates/template.xhtml">
<ui:define name="title">
#{mainBean.titulo} v#{mainBean.versao} #{mainBean.empresa}
</ui:define>
<ui:define name="body">
<center>
<h:panelGrid width="250px" columns="2" border="0">
<rich:panel header="Conexão no #{mainBean.titulo}" style="background-color: #ebf3fd;">
<h:form id="LoginForm">
<h:outputText value="#{mainBean.messagem}" />
<h:panelGrid id="lpg" columns="2" >
<h:outputText value="Usuário " />
<h:selectOneMenu id="usuarios" value="#{mainBean.usuario}">
<f:selectItems id="usuario" value="#{mainBean.usuarios}" />
</h:selectOneMenu>
<h:outputText value="Senha"/>
<h:inputSecret id="senha" required="true" validatorMessage="Senha entre 5 e 20 caracteres"
value="#{mainBean.senhaInformada}" size="20">
<f:validateLength minimum="5" maximum="20"/>
</h:inputSecret>
<h:outputText value=""/>
<h:message for="senha" style="color: red;"/>
<h:outputText value=""/>
<h:commandButton value="Entrar no Sistema" action="#{mainBean.validUser}" styleClass="submitButton"/>
</h:panelGrid>
</h:form>
</rich:panel>
</h:panelGrid>
</center>
</ui:define>
</ui:composition>
</body>
[/code]
REGRAS DE NAVEGAÇÃO no faces-config.xml
<navigation-rule>
<from-view-id>login.jsf</from-view-id>
<navigation-case>
<from-action>#{mainBean.validUser}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>view/entrada.jsf</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{mainBean.validUser}</from-action>
<from-outcome>failure</from-outcome>
<to-view-id>login.jsf</to-view-id>
</navigation-case>
</navigation-rule>
Método para validar no BB:
public String validUser() throws Exception{
String returnString = "success";
if(!usuario.getSenha().toLowerCase().equals( senhaInformada.toLowerCase() )){
returnString = "failure";
setMessagem("User Name or Password is incorrect.");
}
return returnString;
}
Esqueci alguma coisa?