title: Struts2 Dispatcher FilterMapping Cannot be Found
body: <p>I'm using the Tuckey URL re-write filter which works fine. However I'm trying to use Struts2 to implement a login system for my web app. So far I've been able to bypass my other service calls so they pass through struts (they are webservlets and I don't want to use struts for them). I can hit them, however I can't access my Login.jsp. I've tried all kinds of mixing and matching with no luck. Ultimately I want to be able to use my existing webservlets but route the user to the login page if there is not a valid session and not allow access to two pages if the user hasn't logged in. But right now I'm just trying to get the login screen to show up. I get them both working separately but can't messh them to work together.</p>
  
  <p>Any idea on how to make the login page show up?</p>
  
  <h2>Struts.xml</h2>
  
  <pre><code>     &lt;struts&gt;
      &lt;constant name="struts.action.excludePattern" value="/InsertMessage, /AutoComplete"/&gt;
          &lt;constant name="struts.custom.i18n.resources" value="LoginAction"/&gt;
      &lt;package name="default" extends="struts-default" namespace="/"&gt;
          &lt;action name="Login" class="controls.LoginAction" &gt;
               &lt;result name="success"&gt;Listing.jsp&lt;/result&gt; 
               &lt;result name="input"&gt;Login.jsp&lt;/result&gt; 
          &lt;/action&gt;
          &lt;action name="InsertMessage"&gt;
            &lt;result&gt;/InsertMessage&lt;/result&gt;
          &lt;/action&gt;
      &lt;/package&gt;
  &lt;/struts&gt;
  </code></pre>
  
  <h2>web.xml</h2>
  
  <pre><code>  &lt;filter&gt;
              &lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt;
              &lt;filter-class&gt;org.tuckey.web.filters.urlrewrite.UrlRewriteFilter&lt;/filter-class&gt;
              &lt;init-param&gt;
                  &lt;param-name&gt;confPath&lt;/param-name&gt;
                  &lt;param-value&gt;/WEB-INF/urlrewrite.xml&lt;/param-value&gt;
              &lt;/init-param&gt;
          &lt;/filter&gt;
          &lt;filter-mapping&gt;
              &lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt;
              &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
              &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
          &lt;/filter-mapping&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;struts2&lt;/filter-name&gt;
          &lt;filter-class&gt;
              org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
          &lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;struts2&lt;/filter-name&gt;
          &lt;url-pattern&gt;/Listing&lt;/url-pattern&gt;
          &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
          &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
      &lt;/filter-mapping&gt;
          &lt;filter-mapping&gt;
          &lt;filter-name&gt;struts2&lt;/filter-name&gt;
          &lt;url-pattern&gt;/MessageDetail&lt;/url-pattern&gt;
          &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
          &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
      &lt;/filter-mapping&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;struts2&lt;/filter-name&gt;
          &lt;url-pattern&gt;/Login&lt;/url-pattern&gt;
          &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
          &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
      &lt;/filter-mapping&gt;
   &lt;welcome-file-list&gt;
       &lt;welcome-file&gt;login.jsp&lt;/welcome-file&gt;
   &lt;/welcome-file-list&gt;
  </code></pre>
  
  <h2>Login.jsp</h2>
  
  <pre><code>&lt;s:form action="Login"&gt;
      &lt;s:textfield name="userName" label="User Name" /&gt;
      &lt;s:password name="password" label="Password" /&gt;
      &lt;s:submit value="Login" /&gt;
  &lt;/s:form&gt;
  </code></pre>
  
  <h2>Error <code>Login.jsp</code></h2>
  
  <p>HTTP Status 500 - The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]</p>
  
  <p>The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - </p>
  
  <pre><code>[unknown location]
      org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
      org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
      org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
      org.apache.jsp.Login_jsp._jspx_meth_s_005fhead_005f0(Login_jsp.java:111)
      org.apache.jsp.Login_jsp._jspService(Login_jsp.java:80)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:69)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:365)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:309)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:242)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
      org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
      org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
      org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
      org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)
  </code></pre>