title: Is it possible to invoke a Servlet before showing index.jsp
body: <p>I need to do some pre-processing logic which reside in my Struts2 Action class, before showing <code>index.jsp</code> when user access my Java web application for the first time. I tried using the below snippet in <code>web.xml</code> but it failed:</p>
  
  <p><strong>web.xml</strong>:</p>
  
  <pre><code>&lt;welcome-file-list&gt;
      &lt;welcome-file&gt;loginPage.action&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  </code></pre>
  
  <p>To summarize, when user hits <code>http://myjavawebap.com</code>, first the struts2 action <code>loginPage</code> needs to be called and then the action should dispatch the default index.jsp file. Is there any way to achieve this?</p>