1 Reply Latest reply on Jan 25, 2008 10:41 AM by Ronald van Kuijk

    Problem with navigation-rules

    Sara Rodríguez Dorrego Novice

      I want to navigate to other page when I fill a form and I send the data that I entered. I have declare the navigation-rules but it doesn't work and I don't know why.

      In my faces-config.xml I've added the navigation-rules:

       <managed-bean>
       <managed-bean-name>usuario</managed-bean-name>
       <managed-bean-class>com.miApp.UserBean</managed-bean-class>
       <managed-bean-scope>request</managed-bean-scope>
       </managed-bean>
      
       <navigation-rule>
       <from-view-id>/SolicitarAlta.xhtml</from-view-id>
       <navigation-case>
       <from-action>#{usuario.registrar}</from-action>
       <from-outcome>correcto</from-outcome>
       <to-view-id>/results/correcto.jsp</to-view-id>
       </navigation-case>
       </navigation-rule>
      


      The UserBean has the method registrar:

      public String registrar() {
      
       if(dni==null || nombre==null || apellidos==null || ocupacion==null || mail==null || tlf==null || password==null)
       return "campos-obligatorios";
      
       if ((mail.trim().length() < 3) || (mail.indexOf("@") == -1))
       return "mail-incorrecto";
       else if(tlf.length()!=9) return "telefono-incorrecto";
       else if(dni.length()!=8) {return "dni-incorrecto";}
       return "correcto";
       }
      


      And with this line
      <h:commandButton type="submit" value="Enviar" action="#{usuario.registrar}"/>
      the method registrar is executed and I know that this method returns the string "correcto" but ... This doesn't redirect me to the page correcto.jsp

      I thought that maybe if SolicitarAlta was an xhtml file the correcto page should be also an .xhtml file. I changed it but it doesn't work.

      Any ideas? Could it be that I have to add something more in the faces-config.xml & web.xml file???

      Thx!