title: how to validate the session in spring mvc interceptor
body: <p>I am newbie to spring framework.In my code,i use the interceptor for checking the session exists or not.If session exists i allow to call the controller otherwise i redirect the login page.
  Below is my code.</p>
  
  <pre><code>@Override
      public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
  
  
  
          Users user=(Users) session.getAttribute("user");
          if(user == null)
          {
              System.err.println("Request Path : ");
              response.sendRedirect("index");
              return false;
          }
          else
          {
              return true;
          }
      }
  </code></pre>
  
  <p>but this code not redirect successfully.I am getting the below error,</p>
  
  <pre><code>In Mozilla i get below error
      The page is not redirecting properly
  In chorme i get below error?
      This web page has redirect loop
  </code></pre>
  
  <p>How to fix this issue?Any help will be greatly appreciated!!!</p>