title: Spring MVC: Mapping Multiple URLs to Same Controller
body: <p>I have like 20+ forms which are linked from the same page. Some forms share the same controller, while others use their own. For example, form <code>A</code>, <code>B</code>, and <code>C</code> use <code>DefaultController</code>, while form <code>D</code> uses <code>ControllerD</code>. </p>
  
  <p><em>What I would like to achieve is to map the URL to each form in a consistent way.</em> </p>
  
  <p>So, ideally, the link page would look like :</p>
  
  <ul>
  <li><p>either this</p>
  
  <pre><code>&lt;a href="/formA.html"&gt;Form A&lt;/a&gt;
  &lt;a href="/formB.html"&gt;Form B&lt;/a&gt;
  &lt;a href="/formC.html"&gt;Form C&lt;/a&gt;
  &lt;a href="/formD.html"&gt;Form D&lt;/a&gt;
  </code></pre></li>
  <li><p>or this:</p>
  
  <pre><code>&lt;a href="/form.html?name=A"&gt;Form A&lt;/a&gt;
  &lt;a href="/form.html?name=B"&gt;Form B&lt;/a&gt;
  &lt;a href="/form.html?name=C"&gt;Form C&lt;/a&gt;
  &lt;a href="/form.html?name=D"&gt;Form D&lt;/a&gt;
  </code></pre></li>
  </ul>
  
  <p>The question is how to map each URL to the appropriate controller. With the first URL pattern, you would map <code>formD.html</code> to <code>ControllerD</code>, but not sure how to map <code>form[A|B|C].html</code> to <code>DefaultController</code>. With the second URL pattern, I don't even know where to begin... </p>
  
  <p>Has anyone done something like this?</p>