10 Replies Latest reply on Feb 19, 2007 2:06 PM by Fernando Montaño

    Problems with navigations with null outcomes

    Fernando Montaño Expert

      Hi.

      I am just changing all navigation rules from faces-config.xml to pages.xml.

      Then when my action returns a null outcome it does not redisplay the current page.

      I have this method in my component:

      @Stateful
      @Name("userManager")
      public class UserManagerAction {
      ...
      public String create() {
       em.persist(user);
       em.flush();
       return "userList";
       } catch (EntityExistsException e) {
       return Outcome.REDISPLAY;
       }
      }
      }
      


      And according the documentation (1.1.6) I tried two configuration in my pages.xml:

      a) (This is not in the docs, but I saw it in this forum)

      
      <page view-id="/user/new.xhtml" no-conversation-view-id="/user/list.xhtml">
       <navigation from-action="#{userManager.create}">
       <redirect view-id="/user/list.xhtml"/>
       </navigation>
       </page>
      
      



      b) (according the book)

      <page view-id="/user/new.xhtml" no-conversation-view-id="/user/list.xhtml">
       <navigation from-action="#{userManager.create}">
       <rule>
       <redirect view-id="/user/list.xhtml"/>
       </rule>
       </navigation>
       </page>
      



      In the both cases (a, b) after userManager.create() returns null or Outcome.REDISPLAY the current page is not redisplayed, I always get the list.xhtml page.


      Anyone knows why?

      Could this be a bug? or is it my fault?

      Please help me.

      BTW, it could be good idea to add to Outcome class something like:
      Outcome.SUCCESS. This because in these cases (using navigations with String returning methods and pages.xml navigations) the outcome sometimes does not matter. I know we can use void methods, but adding error messages and checking those in the navigation rule involves more configuration steps, I think unnecessary for these cases. What do you think?



      Thanks in advance.