title: Struts 2 interceptor redirect JSP page
body: <p>Using Struts 2, I have this interceptor:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class AccessInterceptor extends AbstractInterceptor {
      @Override
      public String intercept(ActionInvocation ai) throws Exception {
          ActionContext actionContext = ai.getInvocationContext();
          Map&lt;String, Object&gt; session = actionContext.getSession();
          Boolean logged = (Boolean) session.get("logged");
          if(logged == null) {
            session.put("logged", false);
            logged = false;
          }
          if (!logged) {
              // If exception is here, it IS thrown, so I am sure "login" is returned on /homepage
              return "login";
          }   
          return ai.invoke();
      }
  }
  </code></pre>
  
  <p>And this <code>struts.xml</code>:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE struts PUBLIC
      "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
      "http://struts.apache.org/dtds/struts-2.0.dtd"&gt;
  
  &lt;struts&gt;
  &lt;constant name="struts.devMode" value="true" /&gt;
  &lt;package name="loginInterceptor" namespace="/" extends="struts-default"&gt;
      &lt;interceptors&gt; 
          &lt;interceptor name="access"
           class="logininterceptor.interceptors.AccessInterceptor"/&gt;
          &lt;interceptor-stack name="appDefault"&gt; 
              &lt;interceptor-ref name="access" /&gt;
              &lt;interceptor-ref name="defaultStack" /&gt; 
          &lt;/interceptor-stack&gt; 
      &lt;/interceptors&gt; 
      &lt;default-interceptor-ref name="appDefault" /&gt;       
      &lt;global-results&gt;
          &lt;result name="login"&gt;/WEB-INF/content/login.jsp&lt;/result&gt;
      &lt;/global-results&gt;
  &lt;/package&gt;
  &lt;/struts&gt;
  </code></pre>
  
  <p>I have also <code>/WEB-INF/content/homepage.jsp</code> JSP and <code>/WEB-INF/content/login.jsp</code> and <code>mypackage.LoginAction.java</code> class. There is not an acton class for homepage</p>
  
  <p>The problem is, that when I go to the <code>/homepage</code> page, it is NOT redirected to <code>login.jsp</code> and I see the <code>homepage.jsp</code> content. What is wrong?</p>
  
  <p>PS: I use struts2-convention-plugin</p>