Navigation-rule não está funcionando no jsf1.2

0 respostas
Y

Estou iniciando com o desenvolvimento com jsf e criei um exemplo com uma tela de login. Quero que quando for executado o login retorne para uma outra página mas não estou conseguindo fazer funcionar de jeito nenhum.

Meu método:

public String entrar(ActionEvent event) {
		if (codigo != null && senha != null) {
			Cliente cliente = new ClienteDAO().getClienteLogin(codigo, senha);
			if (cliente == null) {
				mensagem = "Informe o código e a senha válida para entrar no sistema";
				return null;
			} else {
				return "inicio";
			}
		} else {
			mensagem = "Informe o código e a senha para entrar no sistema";
			return null;
		}
	}

Meu faces-config.xml

<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
    version="1.2">
	<managed-bean>
		<managed-bean-name>loginBean</managed-bean-name>
		<managed-bean-class>br.com.defferrari.clientes.view.LoginBean</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
	</managed-bean>
	<navigation-rule>
		<navigation-case>
			<from-action>#{loginBean.entrar}</from-action>
			<from-outcome>inicio</from-outcome>
			<to-view-id>/inicio/inicio.jsp</to-view-id>
			<redirect/>
		</navigation-case>
	</navigation-rule>

</faces-config>

meu web.xml

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>CRM</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  
  <listener>  
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
  
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
  
<filter> 
   <display-name>RichFaces Filter</display-name> 
   <filter-name>richfaces</filter-name> 
   <filter-class>org.ajax4jsf.Filter</filter-class> 
</filter> 

<filter-mapping>
   <filter-name>richfaces</filter-name> 
   <servlet-name>Faces Servlet</servlet-name>
   <dispatcher>REQUEST</dispatcher>
   <dispatcher>FORWARD</dispatcher>
   <dispatcher>INCLUDE</dispatcher>
</filter-mapping>
</web-app>
Criado 24 de outubro de 2011
Respostas 0
Participantes 1