title: tr:commandLink action method does not navigate to next page.Instead loads same page again
body: <p>In my JSF application ,after successful login, i am navigating to my home page of my application where i have a <code>Logout</code> link.</p>
  
  <p>Here is the related html for logout link.</p>
  
  <pre><code>&lt;div id="top_white"&gt;
          &lt;div style="float: right"&gt;&lt;tr:form&gt;&lt;tr:commandLink id="logout" action="#{Controller.Logout}"&gt;&lt;img alt="logout" src="../../images/logout.gif"/&gt;&lt;/tr:commandLink&gt;&lt;/tr:form&gt;&lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>And here is my <code>Controller</code> which is <code>sessionscoped</code></p>
  
  <pre><code>public class Controller {
  
      private static Logger LOGGER = Logger.getLogger(Controller.class);
  
      public Controller() {
          req = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
          session = req.getSession(false);
          String userid = session.getAttribute("userid").toString();
          if(List == null){
              List = new ArrayList&lt;List&gt;();
              List = new DAO().loadListByid(Long.valueOf(userid));
              LOGGER.debug("successfully loaded the list for the user");
          }
      }
  
      private long Username;
      private String Password=null;
      HttpServletRequest req;
      HttpSession session;
  
  
      private List&lt;List&gt; List=null;
      // getter and setters
  
  
      public String Logout(){
          session.invalidate();
          LOGGER.debug("In LogOut");
          return "loggedout";
      }
  }
  </code></pre>
  
  <p>In the Constructor i check for userid in the session and load specific list to the user.</p>
  
  <p>I also have a <code>ServletFilter</code> which checks for some id in each session.If it is not found it redirects to InvalidUser page.My filter is mapped to <code>/faces/jsp/*</code> so that for all jsp's in the jsp folder are checked for id in the session.</p>
  
  <p>Here is the <code>doFilter</code> method of my filter</p>
  
  <pre><code>public void doFilter(ServletRequest req, ServletResponse res,
              FilterChain chain) throws IOException, ServletException {
  
              LOGGER.debug("In doFilter");
              HttpServletRequest request = (HttpServletRequest) req;
              HttpServletResponse response = (HttpServletResponse) res;
              HttpSession session = request.getSession(false);
              LOGGER.debug("request:" + request.getRequestURL().toString());
              try{
                  if (session.getAttribute("id") != null) {
                      LOGGER.debug("id found:" + session.getAttribute("id"));
                      chain.doFilter(req, res); // id found, so just continue request.
                  } 
              }catch(NullPointerException e){
                  LOGGER.debug("No id found Exception: ", e);
                  response.sendRedirect(properties.getProperty(INVALID_USER_REDIRECTURL, true)); // No id found, so redirect to Invalid user page.
  
              }
  
      }
  </code></pre>
  
  <p>I also added a <code>PhaseListener</code> to debug JSF life cycle which is taken from <a href="http://balusc.blogspot.com/2006/09/debug-jsf-lifecycle.html" rel="nofollow">here</a>.</p>
  
  <p>When the page is first loaded i see the following server log with only first and last phases of JSF lifecycle</p>
  
  <pre><code>["http-bio-8090"-exec-114] DEBUG SessionFilter - In doFilter
  ["http-bio-8090"-exec-114] DEBUG SessionFilter - request:http://my homepageurl
  ["http-bio-8090"-exec-114] DEBUG SessionFilter - id found
  ["http-bio-8090"-exec-114] ERROR org.apache.myfaces.config.FacesConfigurator - Configuration objects do not support clean-up. Update aborted
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - START PHASE RESTORE_VIEW(1)
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - END PHASE RESTORE_VIEW(1)
  ["http-bio-8090"-exec-114] DEBUG org.apache.myfaces.lifecycle.LifecycleImpl - exiting from lifecycle.execute in RESTORE_VIEW(1) because getRenderResponse is true from one of the after listeners
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - START PHASE RENDER_RESPONSE(6)
  ["http-bio-8090"-exec-114] INFO  org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory - Using LifecycleProvider org.apache.myfaces.config.annotation.AllAnnotationLifecycleProvider
  ["http-bio-8090"-exec-114] DEBUG Controller - id found in controller
  ["http-bio-8090"-exec-114] DEBUG DAOProperties - dao.properties loaded successfully
  ["http-bio-8090"-exec-114] DEBUG SvrConnection - In JNDI
  ["http-bio-8090"-exec-114] DEBUG DAO - Successfully connected to database
  ["http-bio-8090"-exec-114] DEBUG DAO - connection closed
  ["http-bio-8090"-exec-114] DEBUG Controller - successfully loaded the list for the user
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - END PHASE RENDER_RESPONSE(6)
  </code></pre>
  
  <p>The above log is as expected because there is no form submission type of stuff.So only first and last phases are listed.</p>
  
  <p>But the real problem comes when i click the <code>Logout</code> commandLink which i mentioned in the top of this post.</p>
  
  <p>After i click the <code>Logout</code> link, here is the server log.</p>
  
  <pre><code>["http-bio-8090"-exec-114] DEBUG SessionFilter - In doFilter
  ["http-bio-8090"-exec-114] DEBUG SessionFilter - request:http://my homepage url
  ["http-bio-8090"-exec-114] DEBUG SessionFilter - appid found
  ["http-bio-8090"-exec-114] ERROR org.apache.myfaces.config.FacesConfigurator - Configuration objects do not support clean-up. Update aborted
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - START PHASE RESTORE_VIEW(1)
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - END PHASE RESTORE_VIEW(1)
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - START PHASE APPLY_REQUEST_VALUES(2)
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - END PHASE APPLY_REQUEST_VALUES(2)
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - START PHASE PROCESS_VALIDATIONS(3)
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - END PHASE PROCESS_VALIDATIONS(3)
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - START PHASE UPDATE_MODEL_VALUES(4)
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - END PHASE UPDATE_MODEL_VALUES(4)
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - START PHASE INVOKE_APPLICATION(5)
  ["http-bio-8090"-exec-114] DEBUG Controller - In LogOut
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - END PHASE INVOKE_APPLICATION(5)
  ["http-bio-8090"-exec-114] DEBUG org.apache.myfaces.lifecycle.LifecycleImpl - exiting from lifecycle.execute in INVOKE_APPLICATION(5) because getRenderResponse is true from one of the after listeners
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - START PHASE RENDER_RESPONSE(6)
  ["http-bio-8090"-exec-114] DEBUG LifeCycleListener - END PHASE RENDER_RESPONSE(6)
  ["http-bio-8090"-exec-116] DEBUG SessionFilter - In doFilter
  ["http-bio-8090"-exec-116] DEBUG SessionFilter - request:http://my homepage url
  ["http-bio-8090"-exec-116] DEBUG SessionFilter - No id found Exception:
  java.lang.NullPointerException
  </code></pre>
  
  <p>From the above log ,as expected my action method is invoked in the  <code>INVOKE_APPLICATION</code> and my controller's <code>Logout()</code> method is called and session is invalidated and string <code>loggedout</code> is returned.</p>
  
  <p>I have the following navigation rule in the <code>faces-config.xml</code></p>
  
  <pre><code>&lt;navigation-rule&gt;
      &lt;from-view-id&gt;/jsp/Services.jsp&lt;/from-view-id&gt;
      &lt;navigation-case&gt;
        &lt;from-outcome&gt;loggedout&lt;/from-outcome&gt;
        &lt;to-view-id&gt;/others/Logout.jsp&lt;/to-view-id&gt;
      &lt;/navigation-case&gt;
    &lt;/navigation-rule&gt;
  </code></pre>
  
  <p>But this <code>navigation-rule</code> does not execute. Instead in the <code>RENDER_RESPONSE</code> Phase, it tries to reload my same home page url.obviously it does not have the <code>id</code> in the session which is causing to throw a <code>NullPointerException</code>.</p>
  
  <p>I have the jsp's in the respective folders as given above.I am using JSF 1.2 and myFaces 1.2.9.</p>
  
  <p>1)Why navigation-case does not execute?</p>
  
  <p>2)Why it is reloading my home page url again?</p>
  
  <p>Please somebody help.</p>