title: Struts struts-config.xml action-mapping explained
body: <p>I am a noob to Struts framework. I am trying to understand how action-mapping works exactly. Suppose I have a JavaScript file that sends an AJAX request:</p>
  <pre class="lang-js prettyprint-override"><code>$(&quot;button&quot;).click(function(){
      $.ajax({url: &quot;myTestUrl.do&quot;, success: function(result){
          //do something with result
      });
  });
  </code></pre>
  <p>and my <code>struts-config.xml</code> file looks like this:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;
  &lt;!DOCTYPE struts-config PUBLIC &quot;-//Apache Software Foundation//DTD Struts Configuration 1.1//EN&quot; &quot;http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd&quot;&gt;
  &lt;struts-config&gt;
      &lt;form-beans&gt;
          &lt;form-bean name=&quot;testForm&quot; type=&quot;com.test.TestForm&quot;/&gt;       
      &lt;/form-beans&gt;
      
      &lt;!-- Global Forwards --&gt;    
      &lt;global-forwards&gt;
      &lt;/global-forwards&gt;
      
      &lt;!-- Action Mappings --&gt;
      &lt;action-mappings&gt;
  
          &lt;action path=&quot;/myTestUrl&quot; 
                  type=&quot;com.test.TestAction&quot; 
                  name=&quot;testForm&quot; 
                  scope=&quot;request&quot; /&gt;
  
      &lt;/action-mappings&gt;
      &lt;controller locale=&quot;true&quot;/&gt;
  &lt;/struts-config&gt;
  </code></pre>
  <p>I don't understand the relationship between the <code>action</code> and the <code>form-bean</code>. Will my request be handled by <code>TestAction</code>? If so, what is the purpose of the form bean <code>type</code> attribute?</p>
  <p><strong>UPDATE</strong>:</p>
  <p>For anyone who needs a great overview of struts MCV framework check out <a href="http://www.javaranch.com/journal/2002/03/newslettermar2002.jsp#struts" rel="nofollow noreferrer">this</a> link.</p>