title: Using Navigation in JSF
body: <p><strong>Framework: JSF 2.0.</strong> </p>
  
  <p><strong>My problem</strong>: I have a page, called login.xhtml. Whenever someone view that page, it invoked a filter, called Authentication filter. The filter will check, if user already loged in, it will be redirected to default based on user's role (for example: Admin will go to "admin/admin.xhtml", student will be redirected to "user/user.xhtml").</p>
  
  <p><strong>My solution:</strong> Using the <strong>JSF Navigation</strong></p>
  
  <p><strong>My config:</strong></p>
  
  <p><em><strong>faces-config.xml</em></strong></p>
  
  <pre><code>&lt;navigation-rule&gt;
      &lt;from-view-id&gt;*&lt;/from-view-id&gt;
      &lt;navigation-case&gt;
          &lt;from-outcome&gt;AD&lt;/from-outcome&gt;            
          &lt;to-view-id&gt;/admin/admin.xhtml&lt;/to-view-id&gt;
      &lt;/navigation-case&gt;
      &lt;navigation-case&gt;
          &lt;from-outcome&gt;US&lt;/from-outcome&gt;            
          &lt;to-view-id&gt;/user/user.xhtml&lt;/to-view-id&gt;
      &lt;/navigation-case&gt;
  &lt;/navigation-rule&gt;
  </code></pre>
  
  <p><em><strong>The redirection using navigation:</em></strong> </p>
  
  <pre><code>public static void redirectUsingNavigation(String from, String outCome) {
      FacesContext facesContext = FacesContext.getCurrentInstance();
      facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext, from, outCome);
  }
  </code></pre>
  
  <p><strong>My question:</strong> </p>
  
  <ol>
  <li>When i run the <strong>redirectUsingNavigation("*","AD")</strong> or <strong>redirectUsingNavigation(null,"AD")</strong>, it does <strong>not redirect</strong> me to <strong>admin.xhtml</strong> (i'm still on login.xhtml). How to fix this?</li>
  <li>Any framework support me on this problem?</li>
  </ol>